[Help] Premium System
#1

Hello , i added Function for admins to take premium points from users

PHP код:
CMD:takepp(playeridparams[])
{
        
LoginCheck(playerid);
    if(
User[playerid][accountAdmin] >= 3)
    {
        new 
string[150], idamount;
        if(
sscanf(params"ui"idamount)) return SendClientMessage(playeridCOLOR_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(string150"[PREMIUM POINTS] "red"%s has given %s [%d] Premium Points."GetName(playerid), GetName(id), amount);
        
SendAMessage(-1string);
        
format(string150""green"[PREMIUM POINTS] "white"You have received "grey"%d "white"premium points from an "red"admin"white"."amountUser[id][accountPP]-amount);
        
SendClientMessage(id, -1string);
        
format(string150"» You have given {%06x}%s "white"premium points of "grey"%d"white"."GetPlayerColor(id) >>> 8GetName(id), amount);
        
SendClientMessage(playerid, -1string);
        
format(string128"%s received %d Premium Points from %s."GetName(id), amountGetName(playerid));
        
Log("premium.txt"string);
        
User[id][accountPP] -= amount;
    }
    else
    {
        
SendClientMessage(playerid, -1"» "red"You are not authorized to use this command.");
    }
    return 
1;

But now i want that if the admin want to take more than the having amount with the users an error display to admin .
For Example . A user have 10 premium points and admin type /takepp 0 11 then in this case an error occue
Saying "The player don't have enought premium points."
Reply
#2

pawn Код:
if(User[id][accountPP] =< amount) return SendClientMessage(playerid, 0xFF0000FF, "This Player Dont Have That Much Points!");
Reply
#3

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
pawn Код:
if(User[id][accountPP] =< amount) return SendClientMessage(playerid, 0xFF0000FF, "This Player Dont Have That Much Points!");
Basically what that code does is the following:
If the user's points are equal or lower than the amount given by the admin, it will broadcast the error message.

What you are aiming for:
If the user's points are lower than the amount given by the admin, it will broadcast the error message.

So instead of 'Equal to or lower' you need the 'lower' sign only.

Instead of:
Код:
=<
Use this:
Код:
<
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)