Give XP Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Give XP Command (
/showthread.php?tid=426594)
Give XP Command -
LuffyD - 29.03.2013
Hey
how can i make a Give XP Command only for lvl 4 admin? (Owner)
Re: Give XP Command -
Joshman543 - 29.03.2013
What are you using for your XP function? PlayerInfo[playerid][pExp]
AW: Give XP Command -
LuffyD - 29.03.2013
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?
Re: Give XP Command -
OrMisicL - 29.03.2013
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
Re: Give XP Command -
ACI - 29.03.2013
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;
}
AW: Give XP Command -
LuffyD - 29.03.2013
Its Working.
Thanks!