SA-MP Forums Archive
How to give a killer his victim's weapons? - 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: How to give a killer his victim's weapons? (/showthread.php?tid=135304)



How to give a killer his victim's weapons? - pmk1 - 20.03.2010

hey guys! i'm asking how could i give a killer his victim's weapons? i thought about:

GivePlayerWeapon(killerid, GetPlayerWeapon(playerid);

but i realised it's not working xD

How can i do so? thanks


Re: How to give a killer his victim's weapons? - Richy_Bugger - 20.03.2010

new GetPlayerWeapon(playerid);
GivePlayerWeapon(killerid, GetPlayerWeapon(playerid);





Re: How to give a killer his victim's weapons? - pmk1 - 20.03.2010

got 5 errors xd

C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(586) : warning 219: local variable "GivePlayerWeapon" shadows a variable at a preceding level
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(586) : error 001: expected token: ";", but found "("
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(586) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(587) : error 012: invalid function call, not a valid address
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(587) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(587) : error 001: expected token: ";", but found ")"
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(587) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(587) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.



i don't get what's wrong :S


Re: How to give a killer his victim's weapons? - Valak - 20.03.2010

Looks like you have more than just 5 errors, ref the last one.

Post the lines it mentions are having errors, i.e. lines 586 and 587, plus any surrounding lines that are part of the function.


Re: How to give a killer his victim's weapons? - CJ101 - 20.03.2010

Код:
GivePlayerWeapon(killerid, GetPlayerWeapon(playerid);
Just use that.

Note that this code will only give the weapon they were killed with, not all the weapons.





Re: How to give a killer his victim's weapons? - jameskmonger - 20.03.2010

Quote:
Originally Posted by CJ101
Код:
GivePlayerWeapon(killerid, GetPlayerWeapon(playerid);
You missed a bracke, it's:
Код:
GivePlayerWeapon(killerid, GetPlayerWeapon(playerid));



Re: How to give a killer his victim's weapons? - pmk1 - 20.03.2010

i've added this line, but now i got 1 warning (all errors are gone). It says:
Number of Arguments doesn't match definition.

What's wrong with that?


Re: How to give a killer his victim's weapons? - jameskmonger - 20.03.2010

Don't worry about it, it's just because we used a function as an argument.


Re: How to give a killer his victim's weapons? - aircombat - 20.03.2010

try this :

Код:
new weapon = GetPlayerWeapon(playerid);
GivePlayerWeapon(killerid,weapon);



Re: How to give a killer his victim's weapons? - MadeMan - 20.03.2010

pawn Код:
new weapon, ammo;
for(new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapon, ammo);
    if(ammo > 0)
    {
        GivePlayerWeapon(killerid, weapon, ammo);
    }
}