Data Storage

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Frux

Member
Apr 11, 2020
10
0
0
24
So I'm starting to get familiar with skript but im having troubles understanding how to store data
Basically, what this code does is it gives a player a crystal for each kill, however im trying to get it where it wont give the crystal if that player has killed that same player in the last 5 minutes
Anyone have an idea of how I could go about this?
Code:
on death of a player:
    if attacker is a player:
        if "%region at player%" contains "pvp":
            if ip of attacker contains ip of victim:
                send "{@p} &7Killing someone with the same IP will not award you a pvp crystal!" to attacker
            else:

                make console execute command "/crystal give %attacker% 1"
 
Code:
on join:
    if {ip.%player%} is not set:
        set {ip.%player%} to player's ip

on death of a player:
    if attacker is a player:
        if victim is a player:
            if "%region at player%" contains "pvp":
                if {ip.%attacker%} = {ip.%victim%}:
                    send "{@p} &7Killing someone with the same IP will not award you a pvp crystal!" to attacker
                else:
                    console command "crystal give %attacker% 1"
 
Code:
on join:
    if {ip.%player%} is not set:
        set {ip.%player%} to player's ip

on death of a player:
    if attacker is a player:
        if victim is a player:
            if "%region at player%" contains "pvp":
                if {ip.%attacker%} = {ip.%victim%}:
                    send "{@p} &7Killing someone with the same IP will not award you a pvp crystal!" to attacker
                else:
                    console command "crystal give %attacker% 1"
Oh well thank you for a better way of doing that but it still doesn't answer my question :emoji_frowning:
Im gonna use that tho
 
Oh well thank you for a better way of doing that but it still doesn't answer my question :emoji_frowning:
Im gonna use that tho
You can set a variable to `now` when the player kills another player. (For example, `set {lastkill::%attacker%::%victim%} to now`). Then, you can check how long ago that variable was, and handle it accordingly.
PS That code isn't better, it's actually worse.
 
Status
Not open for further replies.