[help]pickup
#1

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

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 ?
Reply
#3

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

error : array must be indexed playerPickupID

any ways to fix it?
Reply
#5

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

any ways to fix it?
playerPickupID[ i];
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)