Author Topic: "playerid" on publics made by me  (Read 3635 times)

0 Members and 1 Guest are viewing this topic.

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
"playerid" on publics made by me
« 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
« Last Edit: April 21, 2012, 06:09:11 pm by sseebbyy »

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Do not PM me for support.




Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: "playerid" on publics made by me
« Reply #2 on: April 21, 2012, 10:02:19 pm »
I don't understand 100% ... :-s


Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: "playerid" on publics made by me
« Reply #3 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..
I'm beginning to feel like a Lag God, Lag God

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: "playerid" on publics made by me
« Reply #4 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
Do not PM me for support.




Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: "playerid" on publics made by me
« Reply #5 on: April 24, 2012, 07:39:45 pm »
I understand now, Thank you :)

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.