Small help [+rep]
#1

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" 
Reply
#2

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

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

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

new weapons[13][2];

But then I get tons of errors due to it.
Reply
#5

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;
}
Reply
#6

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]);

Reply
#7

Put

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

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

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

Oh tnx!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)