19.08.2013, 10:13
can someone show me how i can make admin commands with zcmd
thanks.
thanks.
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;
}
//=====[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(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this command!");