[FS] moneypickup can you create it ?
#1

hay people I do not know how to make a moneypickup created I wanted to ask if you guys can this cmd to create?
would be really nice
Thank you in advance
Reply
#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
#3

Originally POST: By RobShakur & BAbul

guys i got it after compile.

CODE:
Quote:

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#define FILTERSCRIPT
#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<150000)
{
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;
}
AFTER COMPILING:

PAWN
Quote:

C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(42) : warning 219: local variable "Amount" shadows a variable at a preceding level
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(67) : error 025: function heading differs from prototype
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(67) : error 029: invalid expression, assumed zero
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(69) : error 010: invalid function or declaration
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(70) : error 010: invalid function or declaration
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(73) : error 001: expected token: ")", but found "&"
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(73) : error 010: invalid function or declaration
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(73 -- 76) : error 010: invalid function or declaration
C:\Documents and Settings\USER\Desktop\Gang war\filterscripts\PickupTEST.pwn(73 -- 76) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.

Help alots Thanks
HEre the file FILTERSCRIPT:
Reply
#4

Lol, why u bumped a 8 months old topic...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)