SA-MP Forums Archive
Small help [+rep] - 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: Small help [+rep] (/showthread.php?tid=320993)



Small help [+rep] - Twinki1993 - 25.02.2012

Well I'm trying to get Weapon data on PlayerDeath, so he would get his weapon returned on spawn...

So player dies with:

Deagle 100 bullets
SPG 1 bullet

On Player Spawn he would get his weapons back..

I've made the code but I don't know how to put it in normally.

PHP код:
public OnPlayerSpawn(playerid)
{
    
GivePlayerWeapon(playeridweapons); // undefined symbol "weapons"
    
return 1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    new 
weapons[13][2];
    for (new 
013i++)
    {
        
GetPlayerWeaponData(playeridiweapons[i][0], weapons[i][1]);
    }
    return 
0;

PHP код:
C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(163) : error 017undefined symbol "weapons" 



Re: Small help [+rep] - FireCat - 25.02.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
    GivePlayerWeapon(playerid, weapons); // undefined symbol "weapons"
    return 1;
}
Where dafuq are you assigning the symbol "weapons"?


Re: Small help [+rep] - Mark™ - 25.02.2012

Your syntax params of GivePlayerWeapon seems to incorrect, should be playerid, weaponid and ammo.


Re: Small help [+rep] - Twinki1993 - 25.02.2012

Well I've made on top of my GM
Quote:

new weapons[13][2];

But then I get tons of errors due to it.


Re: Small help [+rep] - PawnoQ - 25.02.2012

try this:

pawn Код:
new weapons[13][2][MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    for (new i = 0; i < 13; i++)
    {
        GivePlayerWeapon(playerid,weapons[i][0][playerid],weapons[i][1][playerid]);
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    for (new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid,i,weapons[i][0][playerid],weapons[i][1][playerid]);
    }
    return 0;
}



Re: Small help [+rep] - Twinki1993 - 25.02.2012

I've placed that new onto the
Quote:

public OnFilterScriptInit()

Since I'm making FS not GM but then when I've replaced everything including both OnPlayerSpawn on death i've got some errors

Quote:

C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(14) : warning 204: symbol is assigned a value that is never used: "weapons"
C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(16 : error 017: undefined symbol "weapons"
C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(16 : warning 215: expression has no effect
C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(16 : error 001: expected token: ";", but found "]"
C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(16 : error 029: invalid expression, assumed zero
C:\Users\Maki\Desktop\server 0.3d\gamemodes\TwinkisFS.pwn(16 : fatal error 107: too many error messages on one line

Error on this line
Quote:

GivePlayerWeapon(playerid,weapons[i][0][playerid],weapons[i][1][playerid]);




Re: Small help [+rep] - iTorran - 25.02.2012

Put

pawn Код:
new weapons[13][2][MAX_PLAYERS];
outside a callback, not in one.


Re: Small help [+rep] - PawnoQ - 25.02.2012

you have to place this out of a callback (at the top of your script):

pawn Код:
new weapons[13][2][MAX_PLAYERS];



Re: Small help [+rep] - Twinki1993 - 25.02.2012

Oh tnx!