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: Spawn (
/showthread.php?tid=250700)
Spawn -
Admigo - 24.04.2011
Heey scripters
I want to make a gametext if the player spawn but 1 time. I mean if the player dies that the gametext dont appear again.
Thanks admigo!
Re: Spawn -
xir - 24.04.2011
Use this callback
pawn Код:
public OnPlayerRequestSpawn(playerid)
Re: Spawn -
Admigo - 24.04.2011
Quote:
Originally Posted by xir
Use this callback
pawn Код:
public OnPlayerRequestSpawn(playerid)
|
Can you explain that?
Re: Spawn -
Ash. - 24.04.2011
That callback is called when a player presses the "spawn" button from class selection only.
Re: Spawn -
sobolanux - 24.04.2011
Try this:
under the 'main()' (not inside it!) add this:
Код:
enum FirstSpawn
{
pIsFirstSpawn
};
new pSpawnInfo[MAX_PLAYERS][FirstSpawn];
now inside the OnPlayerConnect callback add this:
Код:
pSpawnInfo[playerid][pIsFirstSpawn] = 0;
also add this inside OnPlayerSpawn callback this:
Код:
if(!pSpawnInfo[playerid][pIsFirstSpawn])
{
GameTextForPlayer(playerid, SPAWN_GAMETEXT, SPAWN_TEXTTIME, SPAWN_TEXTSTYLE);
pSpawnInfo[playerid][pIsFirstSpawn] = 1;
}
and under the OnPlayerDisconnect this:
Код:
pSpawnInfo[playerid][pIsFirstSpawn] = 0;
Also, at the top of the script add these defines and edit them with your informations:
Код:
#define SPAWN_GAMETEXT "Spawn text"
#define SPAWN_TEXTTIME 5000
#define SPAWN_TEXTSTYLE 1
I hope this works. Haven`t tested it but if there are any errors reply!
Re: Spawn -
Admigo - 24.04.2011
And how can i make it in welcome message(gametext)?
Re: Spawn -
Admigo - 24.04.2011
Quote:
Originally Posted by sobolanux
Try this:
under the 'main()' (not inside it!) add this:
Код:
enum FirstSpawn
{
pIsFirstSpawn
};
new pSpawnInfo[MAX_PLAYERS][FirstSpawn];
now inside the OnPlayerConnect callback add this:
Код:
pSpawnInfo[playerid][pIsFirstSpawn] = 0;
also add this inside OnPlayerSpawn callback this:
Код:
if(!pSpawnInfo[playerid][pIsFirstSpawn])
{
GameTextForPlayer(playerid, SPAWN_GAMETEXT, SPAWN_TEXTTIME, SPAWN_TEXTSTYLE);
pSpawnInfo[playerid][pIsFirstSpawn] = 1;
}
and under the OnPlayerDisconnect this:
Код:
pSpawnInfo[playerid][pIsFirstSpawn] = 0;
Also, at the top of the script add these defines and edit them with your informations:
Код:
#define SPAWN_GAMETEXT "Spawn text"
#define SPAWN_TEXTTIME 5000
#define SPAWN_TEXTSTYLE 1
I hope this works. Haven`t tested it but if there are any errors reply!
|
Ooh i got it thanks dude!
Re: Spawn -
••• ĤБĶБM ••• - 24.04.2011
What a waste, easier on you, just replace:
pawn Код:
GameTextForPlayer(playerid, SPAWN_GAMETEXT, SPAWN_TEXTTIME, SPAWN_TEXTSTYLE);
With:
pawn Код:
GameTextForPlayer(playerid, "My text.", 5000, 1);
And remove those defines at the starting of the script.
Re: Spawn -
sobolanux - 24.04.2011
I did it that way to make it easier to modify.