dcmd_givecash(playerid,params[]) { new giveplayerid, amount; if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, COLOR_WHITE, "Usage: /givecash [id] [amount]"); else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid ID!"); else if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, COLOR_RED, "ERROR: Insufficient Funds"); else { GivePlayerMoney(giveplayerid, amount); GivePlayerMoney(playerid, 0 - amount); new string[128]; format(string, sizeof(string), "%s has sent you $%d", ReturnPlayerName(playerid),amount); SendClientMessage(giveplayerid, COLOR_YELLOW, string); format(string, sizeof(string),"$%d sent to %s", amount,ReturnPlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_YELLOW, string); } return 1; }
if(strcmp(cmd, "/pay", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
return 1;
}
moneys = strval(tmp);
if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, "You must be level 3 to pay over 1000");
return 1;
}
if(moneys < 1 || moneys > 99999)
{
SendClientMessage(playerid, COLOR_GRAD1, "Dont go below 1, or above 99999 at once.");
return 1;
}
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pLocal] == 106)
{
SendClientMessage(playerid, COLOR_GRAD1, "Command not allowed in this location");
return 1;
}
if (ProxDetectorS(5.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys)
{
ConsumingMoney[giveplayerid] = 1;
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), " You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "%s has paid $%d to %s", sendername, moneys, giveplayer);
PayLog(string);
if(moneys >= 1000000)
{
ABroadCast(COLOR_YELLOW,string,1);
}
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername ,giveplayer);
ProxDetectorVw(30.0, GetPlayerVirtualWorld(playerid), playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Your too far away.");
}
}//invalid id
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
dcmd_givecash(playerid,params[])
{
new
giveplayerid,
amount;
if (sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /givecash [id] [amount]");
else if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid ID!");
else if (GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid, COLOR_RED, "ERROR: Insufficient Funds");
else
{
GivePlayerMoney(giveplayerid, amount);
GivePlayerMoney(playerid, -amount);
new string[100];
format(string, sizeof(string), "%s has sent you $%d", ReturnPlayerName(playerid),amount);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string),"$%d sent to %s", amount,ReturnPlayerName(giveplayerid));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
dcmd_givecash(playerid,params[]) { new ID,Ammount; if(sscanf(params,"dd",ID,Ammount)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /Givecash < Player ID > < Ammount >"); if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,COLOR_RED,"Invalid User!"); GivePlayerMoney(ID,Ammount); GivePlayerMoney(playerid,-Ammount); new Msg[128]; format(Msg,sizeof(Msg),"%s has sent you %d",ReturnPlayerName(ID),Ammount); SendClientMessage(ID,COLOR_GREEN,Msg); format(Msg,sizeof(Msg),"$%d sent to %s",Ammount,ReturnPlayerName(ID)); SendClientMessage(playerid,COLOR_GREEN,Msg); return 1; }
if(strcmp(cmd, "/gc", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount)"); return 1; } if(!IsNumeric(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount) ID Must be a number"); return 1; } if(strval(tmp) == playerid) { SendClientMessage(playerid, COLOR_ERROR, "You cannot send cash to yourself"); return 1; } giveplayerid = strval(tmp); if(!IsPlayerConnected(giveplayerid)) { format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); return 1; } new sendername[24]; new receivername[24]; GetPlayerName(playerid,sendername, 24); GetPlayerName(giveplayerid,receivername, 24); if(GetDistanceBetweenPlayers(playerid,giveplayerid ) > { format(string, sizeof(string), "%s(%d) Is not close enough. You cannot give cash to that player",receivername,giveplayerid); SendClientMessage(playerid, COLOR_ERROR, string); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount)"); return 1; } if(!IsNumeric(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount) Amount must be a number"); return 1; } new cashsend = strval(tmp); if(cashsend <= 0 || cashsend >= 100001) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: Minimum $1 / Maximum $100000"); return 1; } if(GetPlayerMoney(giveplayerid) + cashsend >= 1000001) { SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Send Failed_|"); format(string, sizeof(string), "%s(%d) Does not have enough pockets to carry that ammount of cash ",receivername,giveplayerid); SendClientMessage(playerid, 0x00C7FFAA, string); return 1; } if(GetPlayerMoney(playerid) >= cashsend) { GivePlayerMoney(playerid,-cashsend); GivePlayerMoney(giveplayerid,cashsend); SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Sent_|"); format(string, sizeof(string), "You have sent $%d to %s(%d)",cashsend,receivername,giveplayerid); SendClientMessage(playerid, 0x00C7FFAA, string); SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Cash Received_|"); SendClientMessage(giveplayerid, 0xA9A9A9AA, "If you think that this might be hacked cash then inform a Server Admin asap! /report (id) (reason)"); format(string, sizeof(string), "%s(%d) Has sent you $%d",sendername,playerid,cashsend); SendClientMessage(giveplayerid, 0x00C7FFAA, string); format(string, sizeof(string), "Sender %s(%d) Has sent $%d to receiver %s(%d)",sendername,playerid,cashsend,receivername, giveplayerid); printf("%s",string); } else if(GetPlayerMoney(playerid) < cashsend) { SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Send Failed_|"); format(string, sizeof(string), "You cannot afford to send $%d",cashsend); SendClientMessage(playerid, COLOR_ERROR, string); } return 1; } |
new giveplayerid[24],
new ammount,
tmp = strtok(cmdtext, idx);
dcmd_givemoney(playerid,params[])
{
new pName[24], str[128], string[128], string2[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str),PlayerFile,pName);
if(!(dini_Int(str, "AdminLevel") >= 1))
{
SendClientMessage(playerid, COLOR_RED, "Admins Only!");
return 1;
}
new player, money, tmp[256];
money = strval(tmp);
if(sscanf(params,"ui",player,money))
{
SendClientMessage(playerid, COLOR_4, "USAGE: /givemoney [PlayerID] [Ammount]");
return 1;
}
if(!IsPlayerConnected(player))
{
SendClientMessage(playerid, COLOR_RED, "Invalid Player ID.");
return 1;
}
else {
new name[24];
GetPlayerName(player, name, sizeof(name));
GivePlayerMoney(player, money);
format(string,sizeof(string),"You gave %d$ to %s!",money, name);
format(string2,sizeof(string2),"Admin %s gave %d$ to you!",pName,money);
SendClientMessage(playerid,COLOR_1,string);
SendClientMessage(player,COLOR_1,string2);
}
return 1;
}