[FS] moneypickup can you create it ?
#2

maybe that will help you, its a very basic money drop FS...
btw: you need the sscanf include by ******
Код:
#define FILTERSCRIPT

#include <a_samp>

#include <sscanf>// credits to ******
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define MSGFAIL_COLOR 0xff55aaff
#define MSGCOMM_COLOR 0x55aaff77

//Pickup IDs used
#define MoneyPack		1212
#define MoneyBag		1550

const PickupsMax=120;
new Pickups=0;
new PUMoney[PickupsMax];
new PUAmount[PickupsMax];

public OnFilterScriptInit()
{
	Pickups=0;
	return 1;
}

public OnFilterScriptExit()
{
	for (new p=1;p<PickupsMax;p++)
	{
		DestroyPickup(PUMoney[p]);
	}
	return 1;
}

forward OnPlayerDeath(playerid);
public OnPlayerDeath(playerid)
{
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	new Amount=GetPlayerMoney(playerid)/10;
	if(Amount>0)
	{
		DropPickupMoney(playerid,Amount);
	}
	return 1;
}

forward OnPlayerPickUpPickup(playerid,pickupid);
public OnPlayerPickUpPickup(playerid,pickupid)
{
	for (new p=0;p<PickupsMax;p++)
	{
		if (pickupid==PUMoney[p] && PUAmount[p]>0)
		{
			new string[64];
			format(string,sizeof(string),"~w~you found~n~~y~$ ~g~~h~%d",PUAmount[p]);
			GameTextForPlayer(playerid,string,4000,5);
			GivePlayerMoney(playerid,PUAmount[p]);
			DestroyPickup(PUMoney[p]);
		}
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(DC, 2, cmdtext);
	return 0;
}

dcmd_DC(playerid,cmdtext[])
{
	new Amount;
	if (sscanf(cmdtext,"d",Amount))
	{
		SendClientMessage(playerid,MSGCOMM_COLOR, "Usage: \"/DC <Amount>\"");
	}
	else
	{
		if(GetPlayerMoney(playerid)<Amount)
		{
			return SendClientMessage(playerid,MSGFAIL_COLOR,"You dont have that much money!");
		}
		if(Amount>0)
		{
			DropPickupMoney(playerid,Amount);
		}
		else
		{
			SendClientMessage(playerid,MSGFAIL_COLOR,"You cant drop negative money!");
		}
	}
	return 1;
}

forward DropPickupMoney(playerid,Amount);
public DropPickupMoney(playerid,Amount)
{
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	Pickups++;
	PUAmount[Pickups]=Amount;
	GivePlayerMoney(playerid,-Amount);
	if(Amount<100000)
	{
		PUMoney[Pickups]=CreatePickup(MoneyPack,3,X+2,Y+2,Z,-1);
	}
	else
	{
		PUMoney[Pickups]=CreatePickup(MoneyBag,3,X+2,Y+2,Z,-1);
	}
	new string[48];
	format(string,sizeof(string),"~r~~h~you dropped~n~~y~$ ~g~~h~%d",Amount);
	GameTextForPlayer(playerid,string,2000,5);
	return 1;
}
Reply


Messages In This Thread
[FS] moneypickup can you create it ? - by RobShakur - 12.03.2010, 12:26
Re: [FS] moneypickup can you create it ? - by Babul - 12.03.2010, 13:11
Re: [FS] moneypickup can you create it ? - by Dr.Ghost - 01.11.2010, 15:09
Re: [FS] moneypickup can you create it ? - by [MWR]Blood - 01.11.2010, 15:25

Forum Jump:


Users browsing this thread: 1 Guest(s)