SA-MP Forums Archive
2 problem with script - 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: 2 problem with script (/showthread.php?tid=303346)



1 problem with script - Tanush123 - 13.12.2011

pawn Код:
GetPlayerPos(killerid,X,Y,Z);
    GetPlayerName(playerid,Nam,sizeof(Nam));
    GetPlayerName(killerid,pname, sizeof(pname));
    GetWeaponName(weap,WeapName,32);
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i,5,X,Y,Z))
        {
            format(str,sizeof(str),"%s has been killed by %s. Weapon: %s",Nam,pname,WeapName);
            SendClientMessage(i,orange,str);
        }
    }
Well the problem is
1.For the weapon it shows Weapon: it doesnt show the weapon name


Re: 2 problem with script - -Rebel Son- - 13.12.2011

Do you have the weapon names defined?


Re: 2 problem with script - Tanush123 - 13.12.2011

yea, it works properly with /giveweapon


Re: 2 problem with script - Tanush123 - 13.12.2011

bump


Re: 2 problem with script - Rob_Maate - 13.12.2011

Show us how "weap" gets its value


Re: 2 problem with script - Tanush123 - 13.12.2011

my weap is
pawn Код:
new weap;



Re: 2 problem with script - Rob_Maate - 13.12.2011

Well that's why... how do you expect it to return a result if you haven't given it a value?

GetWeaponName needs a Weapon ID (i.e 24 for Desert Eagle) for it to return the name of that weapon ID.

If this was in OnPlayerDeath, replace "weap" with "reason"