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



[help]pickup - hvampire - 28.01.2010

i made a command for making a pickup (/pickup (ID) )

if(strcmp(cmdtext, "/pickup", true) == 0)
{
if(IsPlayerAdmin(playerid))
{

new Float:X, Float:Y, Float:Z, Float:Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
X += (3 * floatsin(-Ang, degrees));
Y += (3 * floatcos(-Ang, degrees));
return CreatePickup(1274, 2, X+2, Y, Z);
}
else return SendClientMessage(playerid,0xAA3333AA,"You Aren't Rcon Admin");
}


but when i use /pickup 1274 (which is the dollar) and some one pick it nothing happens , how to make when player pick it up he gets 1000 $

i made this :

public OnPlayerPickUpPickup(playerid,pickupid)
{
if (pickupid == 1274)
{
GivePlayerMoney(playerid,1000);
}
}

but it doesnt work??


Re: [help]pickup - Onyx09 - 28.01.2010

i dont get what your trying to do ? so your placing icons in the map for example the dollar icon?
then if someone is on top of it and type /pickup it gives the person the money?

is that what you trying to do ?


Re: [help]pickup - mansonh - 28.01.2010

1274 is the id of the money object not the id of your pickup that you created.

new playerPickupID[MAX_PLAYERS];

if(strcmp(cmdtext, "/pickup", true) == 0)
{
if(IsPlayerAdmin(playerid))
{

new Float:X, Float:Y, Float:Z, Float:Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
X += (3 * floatsin(-Ang, degrees));
Y += (3 * floatcos(-Ang, degrees));
playerPickupID[playerid] = CreatePickup(1274, 2, X+2, Y, Z); //playerPickupID[playerid] != 1274
return 1;
}
else return SendClientMessage(playerid,0xAA3333AA,"You Aren't Rcon Admin");
}


but when i use /pickup 1274 (which is the dollar) and some one pick it nothing happens , how to make when player pick it up he gets 1000 $

i made this :

public OnPlayerPickUpPickup(playerid,pickupid)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(pickupid == playerPickupID[i]
{
GivePlayerMoney(playerid,1000);
return 1;
}
}
}


Re: [help]pickup - hvampire - 28.01.2010

error : array must be indexed playerPickupID

any ways to fix it?


Re: [help]pickup - mansonh - 28.01.2010

Quote:
Originally Posted by hvampire
error : array must be indexed playerPickupID

any ways to fix it?
playerPickupID[ i];


Re: [help]pickup - MadeMan - 28.01.2010

pawn Код:
if(pickupid == playerPickupID[i])