11.04.2012, 21:48
How to create this command /transfer to
When a player types /transfer to Show Dialog,Type player's ID, than, Type How much money to transfer all in dialog, ho will help me +REP !
When a player types /transfer to Show Dialog,Type player's ID, than, Type How much money to transfer all in dialog, ho will help me +REP !
Код:
if(strcmp(cmd, "/transfer", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, "Morate biti level 3!");
return 1;
}
if(PlayerInfo[playerid][pLocal] != 103)
{
SendClientMessage(playerid, COLOR_GREY, "Niste u banci!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Koristi: /transfer [ID Igraca] [kolicina]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Koristi: /transfer [ID Igraca] [kolicina]");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerNameEx(playerid, sendername, sizeof(sendername));
playermoney = PlayerInfo[playerid][pAccount] ;
if (moneys > 0 && playermoney >= moneys)
{
PlayerInfo[playerid][pAccount] -= moneys;
PlayerInfo[giveplayerid][pAccount] += moneys;
format(string, sizeof(string), "Prebacili ste $%d na %s-ev racun", moneys, giveplayer,giveplayerid);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), "Primili ste $%d na vas racun od %s-a", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "Igracot %s prefrli $%d na %s (/transfer)", sendername, moneys, giveplayer);
if(moneys >= 10000)
{
ABroadCast(COLOR_YELLOW,string,1);
}
printf("%s", string);
PayLog(string);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Nepravilan iznos!");
}
}
}
else
{
format(string, sizeof(string), "%d nije aktivan igrac.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}

