OnPlayerSpawn - 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)
+--- Thread: OnPlayerSpawn (
/showthread.php?tid=436701)
OnPlayerSpawn -
CirCuz™ - 12.05.2013
Hi. I've been thinking for a while and I have no idea how to do the following thing:
Okay, OnPlayerSpawn I want a message that a person has spawned. That is a simple code.
Also I need to kind of give players weapons OnPlayerSpawn too, but the problem is that OnPlayerSpawn is
kind of linked upon OnPlayerDeath too, so when a player respawns, it says in the chat " (playername) has spawned! "
How can I kind of seperate these two scripts?
- Cir
AW: OnPlayerSpawn -
ulbi1990 - 12.05.2013
Use a playervariable which gets set after the FIRST spawn to 1 and ask if the variable == 0 or == 1 in the Callback.
Re: OnPlayerSpawn -
CirCuz™ - 12.05.2013
aaah, thanks man!
Re: OnPlayerSpawn -
Tanush123 - 12.05.2013
pawn Код:
public OnPlayerSpawn(playerid)
{
new str[128],pname[MAX_PLAYER_NAME],firstspawned[MAX_PLAYERS];
GetPlayerName(playerid,pname,sizeof(pname));
if(firstspawned[playerid] == 0)
{
firstspawned[playerid] = 1;
GivePlayerWeapon(playerid,31,99999);
SendClientMessage(playerid,0xFFFFFFFF,"Have a free m4!");
for(new i=0; i<MAX_PLAYERS; i++)
{
format(str,sizeof(str),"%s has spawned",pname);
SendClientMessage(i,0xFFFFFFFF,str);
}
}
return 1;
}
AW: OnPlayerSpawn -
ulbi1990 - 12.05.2013
What the heck are you posting for pseudo code? It's not useful for him to get a whole code snippet, because this way he can't learn anything + the Playervariable would be global better.
Also would it be enough to use SetPVarInt and GetPVarInt when he doesn't have a enum or otherwise anything for players.
Re: AW: OnPlayerSpawn -
Tanush123 - 12.05.2013
Quote:
Originally Posted by ulbi1990
What the heck are you posting for pseudo code? It's not useful for him to get a whole code snippet, because this way he can't learn anything + the Playervariable would be global better.
Also would it be enough to use SetPVarInt and GetPVarInt when he doesn't have a enum or otherwise anything for players.
|
It's also helpful to learn from codes, i learned how to make stuff like dynamic bars and stuff from looking at a dynamic business coding.
Also i'm not using an enum.
pawn Код:
new str[128],pname[MAX_PLAYER_NAME],firstspawned[MAX_PLAYERS];