OnPlayerDeath - 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: OnPlayerDeath (
/showthread.php?tid=157500)
OnPlayerDeath -
matdav - 06.07.2010
Hello, Alright i have two team TEAM_HUMAN and TEAM_ZOMBIE i want if an human died he goes on zombie side
and if everyone is a zombie the game mode restart how can i do it ?
Re: OnPlayerDeath -
CAR - 06.07.2010
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(playerid) == TEAM_HUMAN) {
SendClientMessageToAll(0xFF0000, "A Human died!");
SetPlayerTeam(playerid, TEAM_ZOMBIE);
}
if(GetPlayerTeam(playerid) == TEAM_ZOMBIE) {
SendClientMessageToAll(0xFF0000, "A Zombie died!");
// Restart ?
}
return 1;
}
Re: OnPlayerDeath -
matdav - 06.07.2010
Thx
but what i want to do where u put restart? its only if ALL human died :P
Re: OnPlayerDeath -
FreshKilla - 06.07.2010
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128],sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
switch(GetPlayerTeam(playerid))
{
case TEAM_HUMAN:
{
format(string, sizeof(string), "News: %s has died and turned into a zombie !", sendername);
SendClientMessageToAll(0xFF0000, string);
SetPlayerTeam(playerid, TEAM_ZOMBIE);
}
case TEAM_ZOMBIE:
{
format(string, sizeof(string), "News: %s has died !", sendername);
SendClientMessageToAll(0xFF0000, string);
}
}
return 1;
}
If you wanted to make it so all humans died you'd have to make a variable checking all players teams and etc..
Re: OnPlayerDeath -
matdav - 07.07.2010
Alright thx but thats the problem i dont know how to do these variable o.o
i want ur code but with the variable can u do it ? (i understanded the coe)
Re: OnPlayerDeath -
Gamer_Z - 07.07.2010
if GetPlayerTeam Works u can loop all players with it and check if there is at least 1 human.