Admin Commands -
efrim123 - 19.08.2013
can someone show me how i can make admin commands with zcmd
thanks.
Re: Admin Commands -
JeaSon - 19.08.2013
its my cmd
for exmaple
pawn Код:
CMD:get(playerid,params[])
{
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[playerid][pAdminLevel] >= 2)
{
new targetid;
if(sscanf(params, "u", targetid)) SendClientMessage(playerid,-1,""chat" /get [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(targetid, x+1, y+1, z);
if(IsPlayerInAnyVehicle(targetid))
{
SetVehiclePos(GetPlayerVehicleID(targetid),x,y,z);
}
}
else {
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
}
}
else if(pInfo[playerid][pLogged] == 0)
{
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
Kick(playerid);
}
return 1;
}
if(pinfo[playerid][pAdminLevel] >= 2)
you should something like that
Re: Admin Commands -
efrim123 - 19.08.2013
i get errors with it i need one thats more simple then that
Re: Admin Commands -
Giroud12 - 19.08.2013
Go to TUTORIAL section
http://forum.sa-mp.com/forumdisplay.php?f=70
Re: Admin Commands -
efrim123 - 19.08.2013
Yeah but its kind of hard for me
and i get errors when doing as the tutorial said
Re: Admin Commands -
zaider - 19.08.2013
pawn Код:
//=====[Set HP]=====
CMD:sethp(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this command!");
new targetid,
health;
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR] Player not connected!");
if(sscanf(params, "ui", targetid, health)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /sethp [PlayerID/PartOfName] [Amount]");
SetPlayerHealth(targetid, health);
return 1;
}
if(PlayerInfo[playerid][Adminlevel] < 4 reads the players admin level - you should obviously replace it with your function for getting the players admlvl. Other than that, this function is quite simple. Remember to define the colors at top of your script, else it will return errors, aswell as including sscanf.
Re: Admin Commands -
efrim123 - 19.08.2013
i am getting 4 errors:
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : warning 215: expression has no effect
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : error 029: invalid expression, assumed zero
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : fatal error 107: too many error messages on one line
Re: Admin Commands -
zaider - 19.08.2013
Read what I wrote under the code for understanding your error ..
Re: Admin Commands -
zaider - 19.08.2013
Alternatively you can change the line 3 in my code if(playerinfo etc. to:
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this command!");
Then the command will work for you if you're RCON logged in.
Re: Admin Commands -
efrim123 - 19.08.2013
i dont want the command only for rcons i also want it for level admins
But i want to set it as levels and dont double post