[Tutorial] Simple Spawn Protection
#6

Quote:
Originally Posted by Youssef221
View Post
@Infinity, @Sellize, you mean Like this?:
pawn Code:
world = playerid
?
More like

PHP Code:
public OnPlayerSpawn(playerid)
{
     
SetPlayerVirtualWorld(playeridplayerid); // Set his VW to his own playerid
     
Spawntimer[playerid] = SetTimerEx("Spawnprotect"5000false"d"playerid);
     
SendClientMessage(playerid, -1"You are under spawn protection for 5 seconds.");
     
GameTextForPlayer(playerid"~g~Spawn Protection On"30004); // this will send a green game text (because of the ~g~) to the player and it will only last 3000 miliseconds (3 seconds), with the game text type 4
     
return 1;

Also.. I found something weird in your code.
Why would you check if world == 0? You could just do this to prevent the world from being 0:

PHP Code:
public OnPlayerSpawn(playerid)
{
     
SetPlayerVirtualWorld(playeridrandom(39)+1); // Add 1 to the random number to prevent it from being 0
     
Spawntimer[playerid] = SetTimerEx("Spawnprotect"5000false"d"playerid);
     
SendClientMessage(playerid, -1"You are under spawn protection for 5 seconds.");
     
GameTextForPlayer(playerid"~g~Spawn Protection On"30004); // this will send a green game text (because of the ~g~) to the player and it will only last 3000 miliseconds (3 seconds), with the game text type 4
     
return 1;

Reply


Messages In This Thread
Simple Spawn Protection - by Youssef221 - 26.06.2015, 08:43
Re: Simple Spawn Protection - by Infinity - 26.06.2015, 08:59
Re: Simple Spawn Protection - by Youssef221 - 26.06.2015, 09:02
Re: Simple Spawn Protection - by Sellize - 26.06.2015, 09:02
Re: Simple Spawn Protection - by Youssef221 - 26.06.2015, 09:05
Re: Simple Spawn Protection - by Sellize - 26.06.2015, 09:08
Re: Simple Spawn Protection - by Youssef221 - 26.06.2015, 09:22
Re: Simple Spawn Protection - by Sellize - 26.06.2015, 09:26
Re: Simple Spawn Protection - by Youssef221 - 26.06.2015, 09:29

Forum Jump:


Users browsing this thread: 3 Guest(s)