SA-MP Forums Archive
Code Dont Work - 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: Code Dont Work (/showthread.php?tid=89551)



Code Dont Work - Kyle - 02.08.2009

This dont work i want it so that if the president is killed (not TEAM_TERR) i want it to say he was killed in a accident but it dont work

pawn Код:
if(gTeam[playerid] == TEAM_PRES)
{
if(TEAMPRES == playerid)
{
if(gTeam[killerid] != TEAM_TERR)
{
new string[156];
new pname[30];
GetPlayerName(playerid,pname,30);
format(string, sizeof(string),"%s(%d) Is No Longer President",pname,playerid);
SendClientMessageToAll(COLOR_TEAMYELLOW, string);
TEAMPRES = playerid;
GameTextForAll("~b~The President Has Been Killed In An Accident!", 8000, 5);
}
}
return 1;
}



Re: Code Dont Work - member - 02.08.2009

So you want it that if TEAM_TERR (terrorists) kill TEAM_PRES (president) then it says that it is an accident or if TEAM_PRES kills TEAM_PRES?


Re: Code Dont Work - Kyle - 02.08.2009

I Want it so if ANYTHIN BUT team_terr kills pm it says the message


Re: Code Dont Work - Marc_307 - 02.08.2009

Do you mean:
pawn Код:
if(killerid==INVALID_PLAYER_ID);
?


Re: Code Dont Work - Kyle - 02.08.2009

..no


Re: Code Dont Work - xCoder - 02.08.2009

what kind of accident??


Re: Code Dont Work - member - 02.08.2009

Then it should be like this:

pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
    if(gTeam[playerid] == TEAM_PRES && gTeam[killerid] != TEAM_TERR)
    {
        new string[128];
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(string, sizeof(string),"%s(%d) Is No Longer President",pname,playerid);
        SendClientMessageToAll(COLOR_TEAMYELLOW, string);
        GameTextForAll("~b~The President Has Been Killed In An Accident!", 8000, 5);
    }
    return 1;
}
If the dead player is president and the killer is not a terrorist then the message will say he was killed by accident. Untested.


Re: Code Dont Work - Kyle - 03.08.2009

Still dont work when i kill myself it dont say it and im NOT TEAM_TERR im TEAM_PRES so it should work