#1

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!
Reply
#2

Use this callback

pawn Код:
public OnPlayerRequestSpawn(playerid)
Reply
#3

Quote:
Originally Posted by xir
Посмотреть сообщение
Use this callback

pawn Код:
public OnPlayerRequestSpawn(playerid)
Can you explain that?
Reply
#4

That callback is called when a player presses the "spawn" button from class selection only.
Reply
#5

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!
Reply
#6

And how can i make it in welcome message(gametext)?
Reply
#7

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!
Reply
#8

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.
Reply
#9

I did it that way to make it easier to modify.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)