SA-MP Forums Archive
Need help with forbidden spawn. - 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: Need help with forbidden spawn. (/showthread.php?tid=100104)



Need help with forbidden spawn. - Striker_Moe - 02.10.2009

Aight guys, I need a new class added. The only thing is - it should NOT be accessable to everyone, just for selected players. Anyone got a idea how to do that? D:


Re: Need help with forbidden spawn. - _Vortex - 02.10.2009

OnPlayerSpawn
if([pInfo][playerid][SelectedPlayer] == 1)
SetPlayerPos(playerid,x,y,z);

(Note, you need to make an enum for the pInfo stuff)


Re: Need help with forbidden spawn. - Striker_Moe - 02.10.2009

How can I make that enum stuff? Never worked with that.

+ dumb question, is enum something like dini or dudb?


Re: Need help with forbidden spawn. - _Vortex - 02.10.2009

Tbh, now thinking of it, you don't need an enum.

pawn Код:
//on the top of your script
new Special[MAX_PLAYERS];
//OnPlayerConnect
Special[playerid] = 0;
//simple command to make someone a special, using dcmd.
dcmd_special(playerid,params)
{
new giveplayerid = strval(params);
if(!params[0]) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /special [playerid]");
if(!IsPlayerConnected(giveplayerid))return SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid ID!"
if(Special[giveplayerid] == 1) return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is already special.");

Special[giveplayerid] = 1;
return 1;
}

//Under OnPlayerSpawn
if(Special[playerid] == 1) return SetPlayerPos(playerid,x,y,z)
Note: this has not been tested, but it should work.