SA-MP Forums Archive
Standing in Checkpoint for 7 secs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Standing in Checkpoint for 7 secs (/showthread.php?tid=107382)



Standing in Checkpoint for 7 secs - Tigerbeast11 - 09.11.2009

Hi guys!

I have 2 teams, and i have made a checkpoint. I want the player to stand in the checkpoint for 7 secs and if he does, his colour becomes yellow... I want this variable:
pawn Код:
new yellow[MAX_PLAYERS];
to be 1 if the player is on team attackers and has stood in the checkpoint for 10 secs...

I know it is possible to make this, but how?


Re: Standing in Checkpoint for 7 secs - yoni0505 - 09.11.2009

to check if someone is team attacker(killer) check onplayerdeath if the killer's and the victim's teams are the same, if they are, set a variable such as teamkiller[killerid] to 1.
after that, make a checkpoint and when a player enter make an if(); that check if the player is a killer (if teamkiller[playerid] equal to 1), and if so, start a 10 seconds counter that will call a public function that set yellow[playerid] to 1.

thats pretty much the idea


Re: Standing in Checkpoint for 7 secs - Tigerbeast11 - 09.11.2009

No, i dont want to include OnPlayerDeath or anything... Its m fault, i didnt explain enough

Ok, here goes!

I have two teams, TEAM_ATTACKERS and TEAM_DEFENDERS

the defenders have to stop the attackers from getting in the checkpoint. when the attacker is in a checkpoint, how can i make a timer which checks if the attacker has stayed in the checkpoint for 7 seconds?

Do you understand me now, or do I still need to explain more


Re: Standing in Checkpoint for 7 secs - yoni0505 - 09.11.2009

Quote:
Originally Posted by Tigerbeast11
No, i dont want to include OnPlayerDeath or anything... Its m fault, i didnt explain enough

Ok, here goes!

I have two teams, TEAM_ATTACKERS and TEAM_DEFENDERS

the defenders have to stop the attackers from getting in the checkpoint. when the attacker is in a checkpoint, how can i make a timer which checks if the attacker has stayed in the checkpoint for 7 seconds?

Do you understand me now, or do I still need to explain more
now I understand.
you need to use "OnPlayerEnterCheckpoint" callback to set a timer(SetTimer) if the player is an attacker to call a public function that change yellow[playerid].
and use "OnPlayerLeaveCheckpoint" callback to kill the timer(KillTimer) when the player get out of the checkpoint.
you need to know:
https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/OnPlayerLeaveCheckpoint
https://sampwiki.blast.hk/wiki/KillTimer

I hope you find it useful!



Re: Standing in Checkpoint for 7 secs - yom - 09.11.2009

You don't need a timer for this. Use gettime() instead.


Re: Standing in Checkpoint for 7 secs - Tigerbeast11 - 09.11.2009

Ok, but how can i make it check if the player is in the checkpoint for 7 secs?


Re: Standing in Checkpoint for 7 secs - yoni0505 - 09.11.2009

Quote:
Originally Posted by Tigerbeast11
Ok, but how can i make it check if the player is in the checkpoint for 7 secs?
SetTimer or what Orb said, gettime.


Re: Standing in Checkpoint for 7 secs - Tigerbeast11 - 09.11.2009

Quote:
Originally Posted by yoni0505
Quote:
Originally Posted by Tigerbeast11
Ok, but how can i make it check if the player is in the checkpoint for 7 secs?
SetTimer or what Orb said, gettime.
How would i use it? In what way? How would I set the timer to check? plz exlain in more detail cuz im a newbie... :S


Re: Standing in Checkpoint for 7 secs - yoni0505 - 09.11.2009

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by yoni0505
Quote:
Originally Posted by Tigerbeast11
Ok, but how can i make it check if the player is in the checkpoint for 7 secs?
SetTimer or what Orb said, gettime.
How would i use it? In what way? How would I set the timer to check? plz exlain in more detail cuz im a newbie... :S
I gave you links that explain the functions at my second post.
for SetTimer look at:
https://sampwiki.blast.hk/wiki/SetTimer


Re: Standing in Checkpoint for 7 secs - yoni0505 - 09.11.2009

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by yoni0505
Quote:
Originally Posted by Tigerbeast11
Ok, but how can i make it check if the player is in the checkpoint for 7 secs?
SetTimer or what Orb said, gettime.
How would i use it? In what way? How would I set the timer to check? plz exlain in more detail cuz im a newbie... :S
I gave you links that explain the functions at my second post.
for SetTimer look at:
https://sampwiki.blast.hk/wiki/SetTimer