06.09.2011, 23:19
How can i make /transfer dialog from that command:
thanks ...
Код:
if(strcmp(cmd, "/transfer", true) == 0 || strcmp(cmd, "/wiretransfer", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, " You must be level 3 !");
return 1;
}
if(PlayerToPoint(1.0, playerid, 321.5792,129.2914,1007.9657))
{
SCM(playerid, COLOR_GREY, " You are not in the right place !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /transfer [playerid/PartOfName] [amount] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /transfer [playerid/PartOfName] [amount] [reason]");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /transfer [playerid/PartOfName] [amount] [reason]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = PlayerInfo[playerid][pAccount] ;
if (moneys > 0 && playermoney >= moneys)
{
format(string, sizeof(string),"%s wants to transfer you %d$ reason: %s, if you want to accept the money, type /accept money.",sendername,moneys,(result));
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
format(string, sizeof(string),"You have offered %s to accept %d$ reason: %s.Wait his answer.",giveplayer,moneys,(result));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
TransferOffer[giveplayerid] = playerid;
TransferMoney[giveplayerid] = moneys;
format(string, sizeof(string), "%s transferd $%d to %s reason: %s", sendername, moneys, giveplayer, (result));
if(moneys >= 500000)
{
ABroadCast(COLOR_YELLOW,string,1);
}
PayLog(string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
}
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}


