SA-MP Forums Archive
Problem with Dcmd - 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: Problem with Dcmd (/showthread.php?tid=126377)



Problem with Dcmd - Davita - 08.02.2010

Hey everybody,

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);
}



Re: Problem with Dcmd - yoan103 - 08.02.2010

Код:
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
Код:
GivePlayerMoney(playerid, 500);



Re: Problem with Dcmd - Davita - 08.02.2010

no, i typed with /setpickup amount tip a specific amount of money, and the player shall get this amount not 500 or 1000$.