Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: sseebbyy on April 21, 2012, 06:07:07 pm

Title: "playerid" on publics made by me
Post 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:

Code: [Select]
new nameee[256];
Code: [Select]
else if(strcmp(cmd,"test",true) == 0) {
SetTimer("dada",3000,false);
nameee = gPlayers[playerid];
return 1;
}

Code: [Select]
public dada( ) {
new playerid;
playerid = GetPlayerIDFromName(nameee);
SendClientMessage(playerid,COLOR,"TEST");
}

But nothing happens
Title: Re: "playerid" on publics made by me
Post by: stormeus on April 21, 2012, 06:57:36 pm
See: http://forum.vicecitymultiplayer.com/index.php?topic=4773.msg29206#msg29206
Title: Re: "playerid" on publics made by me
Post by: sseebbyy on April 21, 2012, 10:02:19 pm
I don't understand 100% ... :-s

Title: Re: "playerid" on publics made by me
Post by: Fuzzy168 on April 22, 2012, 01:03:40 pm
well.. That is storm's code for setting a timer to a player. If that is what you want to do..
Title: Re: "playerid" on publics made by me
Post by: stormeus on April 22, 2012, 03:16:26 pm
^ 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
Title: Re: "playerid" on publics made by me
Post by: sseebbyy on April 24, 2012, 07:39:45 pm
I understand now, Thank you :)