Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: sseebbyy on April 21, 2012, 06:07:07 pm
-
I trying to put the possibility to add "playerid" in publics made by me but ... idk what is wrong
look at this for example:
new nameee[256];
else if(strcmp(cmd,"test",true) == 0) {
SetTimer("dada",3000,false);
nameee = gPlayers[playerid];
return 1;
}
public dada( ) {
new playerid;
playerid = GetPlayerIDFromName(nameee);
SendClientMessage(playerid,COLOR,"TEST");
}
But nothing happens
-
See: http://forum.vicecitymultiplayer.com/index.php?topic=4773.msg29206#msg29206
-
I don't understand 100% ... :-s
-
well.. That is storm's code for setting a timer to a player. If that is what you want to do..
-
^ Exactly. Just to point out the critical parts:
[pawn]stock RequestHeal( playerid ) { healTimes[playerid] = ( time() + 5 ); }[/pawn]
This requests a heal by making a timestamp 5 seconds into the future and storing it. A timer is called every second to check if there's someone who wants to heal.
[pawn]healTimes > 0[/pawn]
Checks to see that player i is waiting for the event to run.
[pawn]( time() - healTimes ) == 0[/pawn]
Checks to see that the player waited at least 5 seconds. The timestamp for the player to heal, subtracted from the current timestamp, should equal 0, meaning five seconds has passed.
[pawn]healTimes = 0;[/pawn]
Resets their waiting time.
Info about timestamps:
http://en.wikipedia.org/wiki/Unix_time
-
I understand now, Thank you :)