SA-MP Forums Archive
Weird... PickUp Problem - 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: Weird... PickUp Problem (/showthread.php?tid=278606)



Weird... PickUp Problem - Tigerbeast11 - 23.08.2011

pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    new cash;
    cash = CreatePickup(1212,4,x,y,z,-1);
    return 1;
}
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == cash)
    {
        GivePlayerMoney(playerid,100);
    }
    return 1;
}
[CODE]cod5.pwn(83) : warning 204: symbol is assigned a value that is never used: "cash"
cod5.pwn(169) : error 017: undefined symbol "cash"[/PAWN]

I can't see anything wrong with the script, though :/


Re: Weird... PickUp Problem - =WoR=G4M3Ov3r - 23.08.2011

https://sampforum.blast.hk/showthread.php?tid=276222

This should help ya get it working ^^


Re: Weird... PickUp Problem - CyNiC - 23.08.2011

Declare the variable outside the function OnPlayerDeath.

Read about local and global variables: https://sampwiki.blast.hk/wiki/Scripting_Basics#local


Re: Weird... PickUp Problem - Tigerbeast11 - 23.08.2011

Thanks! +Rep!


Re: Weird... PickUp Problem - =WoR=G4M3Ov3r - 23.08.2011

Quote:
Originally Posted by Tigerbeast11
View Post
Thanks! +Rep!
No Problem, Mate. Anytime