Give XP Command
#1

Hey
how can i make a Give XP Command only for lvl 4 admin? (Owner)
Reply
#2

What are you using for your XP function? PlayerInfo[playerid][pExp]
Reply
#3

I think so:
For money its so:
pawn Код:
COMMAND:money(playerid,params[])
{
    if(Admin[playerid] < 4) return NoSuccess(playerid,"You cannot use this Command!");
   
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i,500);
        }
    }
    SendClientMessageToAll(neongruen,"An Admin gave all Players $500!");
    return 1;
}
But how for xP?
Reply
#4

Well, u gotta create ur own XP array to save all the players experience points
something like that
pawn Код:
enum ePlayerInfo
{
    // ....
    XP,
    // ...
};

new PlayerInfo[MAX_PLAYERS][ePlayerInfo]

// Usage
PlayerInfo[playerid][XP] = value;
or you can simply use the score system provided by SAMP by default as an EXP counter
Reply
#5

If you've included 'ZCMD'.

And sscanf2

If not, so add this at the top of your script:

pawn Код:
#include "zcmd"
#include "sscanf2"
Here is some help:

pawn Код:
COMMAND:xp(playerid, params[])
{
    if(PlayerAcc[playerid][AdminLevel] >= 4) // change this to your admin system.
    {
        new target;
        new amount;
        if(sscanf(params, "ud", target, amount)
        {
            new str[128];
            format(str, sizeof(str), "Your XP is now %d .", amount);
            SendClientMessage(playerid, 0xFFFFFFF, str);
            PlayerAcc[playerid][xp] == amount; //change to your system.
        }
        else SendClientMessage(playerid, -1, "USAGE: /xp [Player ID] [Amount]");
    }
    else SendClientMessage(playerid, -1, "Urm... This command is not scripted yet. Use /help to see new commands.");
    return 1;
}
Reply
#6

Its Working.
Thanks!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)