Standing in Checkpoint for 7 secs
#1

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?
Reply
#2

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
Reply
#3

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
Reply
#4

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!
Reply
#5

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

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

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.
Reply
#8

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
Reply
#9

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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)