15.10.2016, 04:42
how can i change this cmd to dialog input:
the first dialog we type the ID that player, then the next dialog will appear this dialog we type the ammount of money you want to send to the other player
Код:
CMD:wiretransfer(playerid, params[])
{
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You must be at least level 3!");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid, 15.0, 2308.7346, -11.0134, 26.7422))
{
SendClientMessageEx(playerid, COLOR_GREY, "you are not in a bank");
return 1;
}
if(PlayerInfo[playerid][pCash] < 0 || PlayerInfo[playerid][pAccount] < 0)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "Your cash on-hand or in the bank is currently at a negative value!");
return 1;
}
if(gettime()-GetPVarInt(playerid, "LastTransaction") < 10) return SendClientMessageEx(playerid, COLOR_GRAD2, "Wait 10s !");
if(PlayerInfo[playerid][pFreezeBank] == 1) return SendClientMessageEx(playerid, COLOR_GREY, "The Bank Is Close now");
new string[128], giveplayerid, amount;
if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessageEx(playerid, COLOR_GREY, "SU DUNG: /wiretransfer [player] [amount]");
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gPlayerLogged{giveplayerid} == 0) return SendClientMessageEx(playerid, COLOR_GREY, "* Player Could Be Offline!");
new playermoney = PlayerInfo[playerid][pAccount] ;
if (amount > 0 && playermoney >= amount)
{
GivePlayerCashEx(playerid, TYPE_BANK, -amount);
GivePlayerCashEx(giveplayerid, TYPE_BANK, amount);
/*PlayerInfo[playerid][pAccount] -= amount;
PlayerInfo[giveplayerid][pAccount] += amount;*/
format(string, sizeof(string), " You have send $%s for account %s's.", number_format(amount), GetPlayerNameEx(giveplayerid),giveplayerid);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recive $%s into your account %s.", number_format(amount), GetPlayerNameEx(playerid), playerid);
SendClientMessageEx(giveplayerid, COLOR_GRAD1, string);
new ip[32], ipex[32];
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerIp(giveplayerid, ipex, sizeof(ipex));
format(string, sizeof(string), "[BANK] %s (IP:%s) da chuyen $%s den %s (IP:%s).", GetPlayerNameEx(playerid), ip, number_format(amount), GetPlayerNameEx(giveplayerid), ipex);
if(amount >= 500000)
{
ABroadCast(COLOR_YELLOW,string,2);
}
Log("logs/pay.log", string);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
SetPVarInt(playerid, "LastTransaction", gettime());
/*OnPlayerStatsUpdate(playerid);
OnPlayerStatsUpdate(giveplayerid);*/
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " Amount Error.");
}
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Player Could Be offline.");
return 1;
}


