ZCMD Problem - 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: ZCMD Problem (
/showthread.php?tid=361382)
ZCMD Problem -
Alexis1999 - 20.07.2012
'eyhoo.
Some hours ago I downloaded ZCMD include and decided to try making something simple first. I tried doing a simple kick command but when I go In game it says Server: Unknown Command. Later on I tried just putting a command to print text "Test" even then it didn't worked.
Here's the code
Код:
CMD:kick(playerid,params[])
{
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid]");
else if(targetid==INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player is not connected.");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not administrator");
Kick(targetid);
return 1;
}
And here's my includes
Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Re: ZCMD Problem -
ViniBorn - 20.07.2012
Don't put in OnPlayerCommandText
pawn Код:
CMD:kick(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not administrator");
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid]");
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player is not connected.");
Kick(targetid);
return true;
}
Re : ZCMD Problem -
Sandiel - 21.07.2012
pawn Код:
COMMAND:kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new targetid, reason[64];
if(!sscanf(params, "us", targetid, reason))
{
if(targetid != INVALID_PLAYER_ID)
{
if(PlayerInfo[playerid][pAdmin] != PlayerInfo[targetid][pAdmin])
{
new str[128], aLVL[MAX_PLAYERS];
aLVL = GetAdminLvlName(playerid);
format(str, sizeof(str), "AdmCmd: {FF9900}%s {FFFF00}%s %s {ff6347}has kicked {FFFF00}%s %s, {ff6347}Reason: %s", aLVL, GetPlayerFirstName(playerid), GetPlayerLastName(playerid), GetPlayerFirstName(targetid), GetPlayerLastName(targetid), reason);
SendClientMessageToAll(0xff6347FF, str);
Kick(targetid);
}
else return SendClientMessage(playerid, COLOR_GREY, "You cannot ban administrators who are equal or superior than yourself, you have recieved a warning for this action!");
}
else return SendClientMessage(playerid, COLOR_GREY, "That player is not connected!");
}
else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [Playerid/PartOfName] [Reason]");
}
else return SendClientMessage(playerid, COLOR_GREY, ".:: You are not authorized to use this command ::.");
return 1;
}
pawn Код:
stock GetAdminLvlName(playerid)
{
new str[64];
if (PlayerInfo[playerid][pAdmin] == 0) str = ("None");
if (PlayerInfo[playerid][pAdmin] == 1) str = ("Moderator");
if (PlayerInfo[playerid][pAdmin] == 2) str = ("Junior Admin");
if (PlayerInfo[playerid][pAdmin] == 3) str = ("General Admin");
if (PlayerInfo[playerid][pAdmin] == 4) str = ("Senior Admin I");
if (PlayerInfo[playerid][pAdmin] == 5) str = ("Senior Admin II");
if (PlayerInfo[playerid][pAdmin] == 1337) str = ("Head Administrator");
if (PlayerInfo[playerid][pAdmin] == 1338) str = ("Server Manager");
if (PlayerInfo[playerid][pAdmin] == 99999) str = ("Community Owner");
return str;
}