Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(strcmp(cmd, "/givecash") == 0) {
- cmd = strtok(NULL, " ");
- if(cmd == 0 || !strlen(cmd)) {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
- return true;
- }
- giveplayerid = atoi(cmd);
- cmd = strtok(NULL, " ");
- if(cmd == 0 || !strlen(cmd)) {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
- return true;
- }
- moneys = atoi(cmd);
- if (IsPlayerConnected(giveplayerid)) {
- GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
- GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
- playermoney = GetPlayerMoney(playerid);
- if (moneys > 0 && playermoney >= moneys) {
- GivePlayerMoney(playerid, (0 - moneys));
- GivePlayerMoney(giveplayerid, moneys);
- sprintf(string, "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- sprintf(string, "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- ServerLog::Printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
- }
- else {
- SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
- }
- }
- else {
- sprintf(string, "%d is not an active player.", giveplayerid);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement