SA-MP Forums Archive
How i can make rcon admin cmd givexp - 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: How i can make rcon admin cmd givexp (/showthread.php?tid=389719)



How i can make rcon admin cmd givexp - Hugoca - 03.11.2012

I'm using this level and exp system.Please tell me how i can make cmd givexp.I wanna this cmd to give "x" exp to all players.


Re: How i can make rcon admin cmd givexp - dr.lozer - 03.11.2012

try this

pawn Код:
CMD:givexp(playerid, pid[], xp[])
{
   new pname[24],rname[24]; GetPlayerName(playerid, rname, 24);
   if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "ERROR: Only Rcon can use this Command");
   if(isnull(pid) || isnull(xp)) return SendClientMessage(playerid, -1,"Usage: /givexp [id] [xp]");
   if(IsPlayerConnected(strval(pid)) {
      GetPlayerName(strval(pid), pname, 24);
      new string[128]; format(string,128,"You have given %s %d XP",pname,strval(xp));
      SendClientMessage(playerid, -1, string);
      format(string,128,"Rcon %s has given you %d XP",rname,strval(xp));
      SendClientMessage(strval(pid), -1, string);
      PlayerInfo[strval(pid)][Exp] = PlayerInfo[strval(pid)][Exp] +strval(xp);
      return 1;
   }else return SendClientMessage(playerid, -1,"ERROR: Player is not connected");
}



Re: How i can make rcon admin cmd givexp - Hugoca - 03.11.2012

Quote:
Originally Posted by dr.lozer
Посмотреть сообщение
try this

pawn Код:
CMD:givexp(playerid, pid[], xp[])
{
   new pname[24],rname[24]; GetPlayerName(playerid, rname, 24);
   if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "ERROR: Only Rcon can use this Command");
   if(isnull(pid) || isnull(xp)) return SendClientMessage(playerid, -1,"Usage: /givexp [id] [xp]");
   if(IsPlayerConnected(strval(pid)) {
      GetPlayerName(strval(pid), pname, 24);
      new string[128]; format(string,128,"You have given %s %d XP",pname,strval(xp));
      SendClientMessage(playerid, -1, string);
      format(string,128,"Rcon %s has given you %d XP",rname,strval(xp));
      SendClientMessage(strval(pid), -1, string);
      PlayerInfo[strval(pid)][Exp] = PlayerInfo[strval(pid)][Exp] +strval(xp);
      return 1;
   }else return SendClientMessage(playerid, -1,"ERROR: Player is not connected");
}
I wanna this cmd to give "x" exp to all players.

Edit:When i use command i give 0 Exp