SA-MP Forums Archive
define playerid HELP PLEASE - 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: define playerid HELP PLEASE (/showthread.php?tid=121244)



define playerid HELP PLEASE - bluray - 16.01.2010

Hi im really stumped. For a certain reason i need to use the word "playerid" in the section Public OnGameModeInit
cause i am using the function
GetPlayerWorld(playerid)
But the problem is playerid wont work in OnGameModeInit, for some reason it needs to be defined.
So i tried fixing it by at the top of the script under main() i placed
PlayerWorld = GetPlayerVirtualWorld(playerid);
new playerid;
playerid =
but i dont know what the function would be to go after playerid =
so im really screw up here. why is that some areas understand what playerid means and others dont?
PLEASE HELP


Re: define playerid HELP PLEASE - [HiC]TheKiller - 16.01.2010

OnGameMode init will be called before any players are on so why would you need GetPlayerWorld(playerid) there?


Re: define playerid HELP PLEASE - bluray - 16.01.2010

well actually sorry not actually there i thought that would have fixed it. Its meant to go in a pulblic call back i made not the ones it already comes with. and i thought maybe putting it in gamemode init will save me from putting it in each callback that requires it


Re: define playerid HELP PLEASE - MadeMan - 16.01.2010

Quote:
Originally Posted by bluray
why is that some areas understand what playerid means and others dont?
Look at the public callback line.

For example:

public OnGameModeInit() - has no parameters.

public OnPlayerConnect(playerid) - has playerid defined.

public OnPlayerDeath(playerid, killerid, reason) - has playerid, killerid and reason defined.

You can use the parameters defined in the callback.








Re: define playerid HELP PLEASE - bluray - 17.01.2010

Quote:
Originally Posted by MadeMan
Quote:
Originally Posted by bluray
why is that some areas understand what playerid means and others dont?
Look at the public callback line.

For example:

public OnGameModeInit() - has no parameters.

public OnPlayerConnect(playerid) - has playerid defined.

public OnPlayerDeath(playerid, killerid, reason) - has playerid, killerid and reason defined.

You can use the parameters defined in the callback.





so can i just add player id in the brackets


Re: define playerid HELP PLEASE - MadeMan - 17.01.2010

Quote:
Originally Posted by bluray
so can i just add player id in the brackets
No, you can only use those that are already there.


Re: define playerid HELP PLEASE - bluray - 17.01.2010

what about for your own created callbacks


Re: define playerid HELP PLEASE - MadeMan - 17.01.2010

If you make your own functions, then yes you can.