I tried to create a kind of pickup that contains money. My problem is, when you pick it up you get no money
So please help me.
Код:
new amount,PickUpObj[MAX_PLAYERS];
dcmd_setpickup(playerid, params[]) {
new tipp, Float:x, Float:y, Float:z, string[128];//PickUpObj[MAX_PLAYERS],amount
if(!IsPlayerAdmin(playerid)) {
return 0;
}
//if (sscanf(playerid,params, "d","z", amount, tipp)) {
if (sscanf(params, "d","s", amount, tipp)) {
SendClientMessage(playerid, 0xFF0000AA, "Use: /setpickup [money] [Tip]!");
} else {
GetPlayerPos(playerid, x, y, z);//1210
PickUpObj[playerid]=CreatePickup(1210, 2, x+2, y, z, -1);
SendClientMessage(playerid, 0x66FF66FF, "Moneypickup spawned!");
format(string, sizeof(string), "A moneypickup was hidden!(Tip:%s)", params[2]);
SendClientMessageToAll(0xFFFF00AA, string);
}
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
new name[MAX_PLAYER_NAME], string[128];
if(pickupid == PickUpObj[pickupid])
GivePlayerMoney(playerid,amount);
DestroyPickup(PickUpObj[playerid]);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s found the moneypickup!", name );
SendClientMessageToAll(0xFFFF00AA, string);
}
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new name[MAX_PLAYER_NAME], string[128];
if(pickupid == PickUpObj[pickupid])
GivePlayerMoney(playerid,amount);
DestroyPickup(PickUpObj[playerid]);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s found the moneypickup!", name );
SendClientMessageToAll(0xFFFF00AA, string);
}
Look at give player money, remove the amount and type after playerid, 500 or 1000 or whatever money you wish and don't forget to close it
no, i typed with /setpickup amount tip a specific amount of money, and the player shall get this amount not 500 or 1000$.