SA-MP Forums Archive
I dont get it! Please help! :/ - 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: I dont get it! Please help! :/ (/showthread.php?tid=187348)



I dont get it! Please help! :/ - OldDirtyBastard - 02.11.2010

how's it possible that when i do

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new weapons[13][2];
    for (new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    }
        return 1;
}
and
pawn Код:
public OnPlayerSpawn(playerid)
{
    new weapons[13][2];
    for (new i = 0; i < 13; i++)
    GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
    return 1;
}
After spawn i dont get the weapons even the code is correct(atleast looks corect to me :P),
now i know that weapons get reset after death so it might be that, but how to hell could be
created scripts like mabakos or garciats weapon drop scripts i mean its basicly the same damn
thing about saving and giving weapons!


Re: I dont get it! Please help! :/ - iJumbo - 02.11.2010

i dont get u xD so u want make a drop weapon script?


Re: I dont get it! Please help! :/ - Slice - 02.11.2010

The variable called "weapons" is local, it only exists inside the functions you create it in. This should work:
The reason I added OnPlayerConnect is so players won't get weapons from previous players.
pawn Код:
new weapon[ MAX_PLAYERS ][ 13 ];
new ammo[ MAX_PLAYERS ][ 13 ];

public OnPlayerConnect( playerid )
{
    for (new i = 0; i < 13; i++)
    {
        weapon[playerid][i] = 0;
        ammo[playerid][i] = 0;
    }
}

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

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



Re: I dont get it! Please help! :/ - OldDirtyBastard - 02.11.2010

Oh dude! thank you so much g_aSlice Nr.1! and btv hows it going with that "Aranha Mod" ^^
i hope that Kye is watching your work ^^ maybe in next versions of sa-mp we gonna see your
name in the credits....
Thanks alot!


Re: I dont get it! Please help! :/ - Slice - 02.11.2010

Quote:
Originally Posted by OldDirtyBastard
Посмотреть сообщение
Oh dude! thank you so much g_aSlice Nr.1! and btv hows it going with that "Aranha Mod" ^^
i hope that Kye is watching your work ^^ maybe in next versions of sa-mp we gonna see your
name in the credits....
Thanks alot!
No problem.
Also, I stopped developing it cause I can't do it all by myself and I couldn't find anyone willing to help out.