Hello Help me>!>!>!
#1

Plesae help me to make This Command ....



max amount is 500K
Reply
#2

BUMB?
Reply
#3

PHP код:
CMD:givemoney(playeridparams[])

new 
giveplayerid,cashamount;
if ( 
sscanfparams"ui"giveplayeridcashamount ) ) return SendClientMessageplayerid, -1"USAGE: {FFFF00}/cashfrom [playerid] [cashamount" );
if ( 
giveplayerid == INVALID_PLAYER_ID ) return SendClientMessageplayerid, -1"Player Is Not Connected!" );
GivePlayerMoney(giveplayeridcashamount);

Reply
#4

This command uses ZCMD:
Код:
COMMAND:gc(playerid, params[])
{
	new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
	if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, -1, "Usage: /gc [Player] [Money]");
	else
	{
		if (IsPlayerConnected(OtherPlayer))
		{
			GetPlayerName(playerid, Name, sizeof(Name));
			GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
			if(Money> 500000 || Money< 0) return SendClientMessage(playerid, -1, "You must use values higher than 0 and lower than 500,000");
			if (GetPlayerMoney(playerid) <= Money) return SendClientMessage(playerid, -1, "You don't have enough money");
			GivePlayerMoney(playerid, -Money);
			GivePlayerMoney(OtherPlayer, Money);
			format(Msg, 128, "You have received $%i from %s", Money, Name);
			SendClientMessage(OtherPlayer, -1, Msg);
			format(Msg, 128, "You gave $%i to %s", Money, OtherName);
			SendClientMessage(playerid, -1, Msg);
		}
					    
	}
	return 1;
}
If you have any problems let me know.
Reply
#5

PHP код:

dcmd_givemoney
(playerid,params[])
{
    new 
string[128];
    new 
IDamount;
    if(
sscanf(params"ui"IDamount))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /givecash (Player Name/ID) (Amount)");
        return 
1;
    }
    if(
pInfo[playerid][Spawned] != 1)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"The Player ID [%d] is not connected to the server. You cannot give money to them.",ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    if(
ID == playerid)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You cannot give money to yourself!!");
        return 
1;
    }
    if(
GetPlayerMoney(playerid) < amount)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You do not have that amount of money in order to give it to someone.");
        return 
1;
    }
    if(
amount 200000 || amount 500)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Please enter an amount between $500 and $200000.");
        return 
1;
    }
    
format(string,sizeof(string),"You have given $%d of your own money to %s[%d].",amount,GetName(ID),ID);
    
SendClientMessage(playerid,COLOR_YELLOW,string);
    
GivePlayerMoney(playerid,-amount);
    
    
format(string,sizeof(string),"You have been given $%d by %s[%d]. Make sure you thank them.",amount,GetName(playerid),playerid);
    
SendClientMessage(ID,COLOR_YELLOW,string);
    
GivePlayerMoney(ID,amount);
    
//+rep me    
    
return 1;

Reply
#6

Quote:
Originally Posted by ayoub001
Посмотреть сообщение
PHP код:

dcmd_givemoney
(playerid,params[])
{
    new 
string[128];
    new 
IDamount;
    if(
sscanf(params"ui"IDamount))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /givecash (Player Name/ID) (Amount)");
        return 
1;
    }
    if(
pInfo[playerid][Spawned] != 1)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"The Player ID [%d] is not connected to the server. You cannot give money to them.",ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    if(
ID == playerid)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You cannot give money to yourself!!");
        return 
1;
    }
    if(
GetPlayerMoney(playerid) < amount)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You do not have that amount of money in order to give it to someone.");
        return 
1;
    }
    if(
amount 200000 || amount 500)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Please enter an amount between $500 and $200000.");
        return 
1;
    }
    
format(string,sizeof(string),"You have given $%d of your own money to %s[%d].",amount,GetName(ID),ID);
    
SendClientMessage(playerid,COLOR_YELLOW,string);
    
GivePlayerMoney(playerid,-amount);
    
    
format(string,sizeof(string),"You have been given $%d by %s[%d]. Make sure you thank them.",amount,GetName(playerid),playerid);
    
SendClientMessage(ID,COLOR_YELLOW,string);
    
GivePlayerMoney(ID,amount);
    
//+rep me    
    
return 1;

You just copied this from your gamemode.
Do you think he have pInfo[playerid][Spawned] defined in his gamemode?
This probably won't work.

Try this instead:
Код:
COMMAND:gc(playerid, params[])
{
	new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
	if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, -1, "Usage: /gc [Player] [Money]");
	else
	{
		if (IsPlayerConnected(OtherPlayer))
		{
			GetPlayerName(playerid, Name, sizeof(Name));
			GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
			if(Money> 500000 || Money< 0) return SendClientMessage(playerid, -1, "You must use values higher than 0 and lower than 500,000");
			if (GetPlayerMoney(playerid) <= Money) return SendClientMessage(playerid, -1, "You don't have enough money");
			GivePlayerMoney(playerid, -Money);
			GivePlayerMoney(OtherPlayer, Money);
			format(Msg, 128, "You have received $%i from %s", Money, Name);
			SendClientMessage(OtherPlayer, -1, Msg);
			format(Msg, 128, "You gave $%i to %s", Money, OtherName);
			SendClientMessage(playerid, -1, Msg);
		}
					    
	}
	return 1;
}
Reply
#7

thanks all I Rep every one help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)