PDA

View Full Version : How i can make rcon admin cmd givexp


Hugoca
03/11/2012, 09:39 AM
I'm using this (http://forum.sa-mp.com/showthread.php?t=377207) level and exp system.Please tell me how i can make cmd givexp.I wanna this cmd to give "x" exp to all players.

dr.lozer
03/11/2012, 11:47 AM
try this


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");
}

Hugoca
03/11/2012, 01:41 PM
try this


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 :D