23.09.2013, 16:21
Hi everyone!,
Im having some trouble with admin commands;
and if you guys could tell me if i made this correct because i get thse errors :\
Thanks for your time!
Im having some trouble with admin commands;
pawn Код:
(1314) : error 017: undefined symbol "cmdtext"
(1314) : warning 215: expression has no effect
(1314) : warning 215: expression has no effect
(1314) : warning 215: expression has no effect
(1314) : error 001: expected token: ";", but found ")"
(1314) : error 029: invalid expression, assumed zero
(1314) : fatal error 107: too many error messages on one line
pawn Код:
CMD:setadmin(playerid,params[])
{
if(!IsPlayerAdmin(playerid)||pInfo[playerid][Adminlevel]<6)return SendClientMessage(playerid,COLOR_RED,"* You're not authorized to use that command");
/*line 1314 */new tmpspace = strfind(cmdtext" ",true,11);
if(!cmdtext[11])return SendClientMessage(playerid,COLOR_WHITE,"* USAGE: /setlevel [playerid] [admin level]");
if(!cmdtext[tmpspace+1]) return SendClientMessage(playerid,COLOR_WHITE,"* USAGE: /setlevel [playerid] [admin level]");
pInfo[strval(cmdtext[11])][Adminlevel] = strval(cmdtext[tmpspace+1]);
new tmpstring[128];
GetPlayerName(strval(cmdtext[11]),tmpstring,MAX_PLAYER_NAME);
format(tmpstring,128,"* You made %s AdminLevel %d",tmpstring,strval(cmdtext[tmpspace+1]));
SendClientMessage(playerid,COLOR_WHITE,tmpstring);
GetPlayerName(playerid,tmpstring,MAX_PLAYER_NAME);
format(tmpstring,128,"* %s made you AdminLevel %d",tmpstring,strval(cmdtext[tmpspace+1]));
return SendClientMessage(strval(cmdtext[11]),COLOR_WHITE,tmpstring);
}
pawn Код:
pawno\include\YSI\y_hooks/impl.inc(654) : warning 219: local variable "reason" shadows a variable at a preceding level
pawno\include\YSI\y_hooks/impl.inc(746) : warning 219: local variable "reason" shadows a variable at a preceding level
(1165) : warning 219: local variable "reason" shadows a variable at a preceding level
(1226) : warning 219: local variable "reason" shadows a variable at a preceding level
(1314) : error 017: undefined symbol "cmdtext"
pawn Код:
CMD:kick(playerid,params[])
{
new reason[80];
if(pInfo[playerid][Adminlevel]<6)return SendClientMessage(playerid,COLOR_RED,"* You're not authorized to use that command");
if (sscanf(params, "us[80]", id,reason)) return SendClientMessage(playerid,COLOR_WHITE,"* USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_WHITE,"* This player is not connected.");
GetPlayerName(playerid, name1, sizeof(name1));
GetPlayerName(id, name2, sizeof(name2));
format(String,sizeof(String),"* %s has been kicked by admin %s Reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_WHITE,String);
Kick(id);
return 1;
}
CMD:ban(playerid,params[]))
{
new reason[80];
if(pInfo[playerid][Adminlevel]<6)return SendClientMessage(playerid,COLOR_RED,"* You're not authorized to use that command");
if(sscanf(params, "us[80]", id,reason)) return SendClientMessage(playerid,COLOR_WHITE,"* USAGE: /ban [playerid] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_WHITE,"* This player is not connected.");
GetPlayerName(playerid, name1, sizeof(name1));
GetPlayerName(id, name2, sizeof(name2));
format(String,sizeof(String),"* %s has been banned by admin %s Reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_WHITE,String);
Ban(id);
return 1;
}