SA-MP Forums Archive
1 Problem - 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)
+--- Thread: 1 Problem (/showthread.php?tid=303526)



1 Problem - Tanush123 - 14.12.2011

Well i want if player dies from splat, it just says "(My Name) has been killed by (Random person Name). Weapon: Splat
I want it to say "(My Name) has been killed from: Splat
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i,10,X,Y,Z))
        {
            if(reason != 47 || reason != 51 || reason != 53 || reason != 54)
            {
                format(str,sizeof(str),"%s has been killed by %s. Weapon: %s",Nam,pname,WeapName);
                SendClientMessage(i,-1,str);
            }
            else if(reason == 47 || reason == 51 || reason == 53 || reason == 54)
            {
                format(str,sizeof(str),"%s has been killed from: %s",Nam,WeapName);
                SendClientMessage(i,-1,str);
            }
        }
    }



Re: 1 Problem - Ballu Miaa - 14.12.2011

What do you want us to help you with?

EDIT:Add comments in your code for better understand of other's. The first if is for all the weapons and the other "if" is for splat? right? So its correct it should work.


Re: 1 Problem - suhrab_mujeeb - 14.12.2011

Have you defined your weapons? If yes, can you show it?


Re: 1 Problem - Rob_Maate - 14.12.2011

Like this?

EDIT: Just re-read your post, your code would work if you replaced the "||" 's with "&&" 's for the first if statement

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerInRangeOfPoint(i,10,X,Y,Z))
    {
        if(reason != 47 && reason != 51 && reason != 53 && reason != 54)
        {
            format(str,sizeof(str),"%s has been killed by %s. Weapon: %s",Nam,pname,WeapName);
            SendClientMessage(i,-1,str);
        }
        else
        {
            new ReasonString[64];
            switch(reason)
            {
                case 47: ReasonString = "Fake Pistol";
                case 51: ReasonString = "Explosion";
                case 53: ReasonString = "Drowned";
                case 54: ReasonString = "Splat";
            }
            format(str,sizeof(str),"%s has been killed via %s",Nam, ReasonString);
            SendClientMessage(i,-1,str);
        }
    }
}



Re: 1 Problem - Tanush123 - 15.12.2011

Thank you rob