19.01.2015, 04:50
Hello , i have points system . I want to have function that when player type /sell he can sell his points by giving how much points he want to sell and amount of money and after clicking on sell button in dialog his points added in /buy so players can buy them from /buy if they have that amount of money .
PHP Code:
CMD:givepp(playerid, params[])
{
LoginCheck(playerid);
if(User[playerid][accountAdmin] >= 3)
{
new string[150] , id, amount;
if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /givepp [playerid] [amount]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "» "red"Player not connected.");
if(User[id][accountLogged] == false) return SendClientMessage(playerid, -1, "» "red"Player not logged in.");
format(string, 150, "[PREMIUM POINTS] "red"%s has given %s [%d] Premium Points.", GetName(playerid), GetName(id), amount);
SendAMessage(-1, string);
format(string, 150, ""green"[PREMIUM POINTS] "white"You have received "grey"%d "white"premium points from an "red"admin"white".", amount, User[id][accountPP]+amount);
SendClientMessage(id, -1, string);
format(string, 150, "» You have given {%06x}%s "white"premium points of "grey"%d"white".", GetPlayerColor(id) >>> 8, GetName(id), amount);
SendClientMessage(playerid, -1, string);
format(string, 128, "%s received %d Premium Points from %s.", GetName(id), amount, GetName(playerid));
Log("premium.txt", string);
User[id][accountPP] += amount;
}
else
{
SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command.");
}
return 1;
}