01.02.2012, 01:52
Can Any Make To Make /SetLevel Command In DCMD For My Admin Script
enum PLAYER_MAIN {
PLAYER_NAME[MAX_PLAYER_NAME],
PLAYER_IP[16],
PLAYER_REGGED,
PLAYER_PASS,
PLAYER_LEVEL,
PLAYER_MONEY,
}
gPlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
gPlayerLogged[MAX_PLAYERS];
enum COMMANDS_MAIN {
KICK,
BAN
}
new gCommands[COMMANDS_MAIN];
dcmd_setadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly.You need sscanf
if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-5!");//Available levels
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,red,"That user is not connected.");//Detect if the id/partofname is connected
if(gPlayerInfo[ID][PLAYER_LEVEL] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
if(levels == 0)
{
format(str, sizeof(str),"%s has your Admin level to %d on the server. ",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
gPlayerInfo[ID][PLAYER_LEVEL] = levels;//this sets the player level
return 1;
}
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
gPlayerInfo[ID][PLAYER_LEVEL] = levels;
return 1;
}
E:\Freeroam World\filterscripts\MAdmin.pwn(473) : error 017: undefined symbol "sscanf" E:\Freeroam World\filterscripts\MAdmin.pwn(474) : error 017: undefined symbol "levels" E:\Freeroam World\filterscripts\MAdmin.pwn(475) : error 017: undefined symbol "ID" E:\Freeroam World\filterscripts\MAdmin.pwn(475) : error 017: undefined symbol "red" E:\Freeroam World\filterscripts\MAdmin.pwn(476) : error 017: undefined symbol "ID" E:\Freeroam World\filterscripts\MAdmin.pwn(477) : error 017: undefined symbol "Nam" E:\Freeroam World\filterscripts\MAdmin.pwn(478) : error 017: undefined symbol "ID" E:\Freeroam World\filterscripts\MAdmin.pwn(479) : error 017: undefined symbol "levels" E:\Freeroam World\filterscripts\MAdmin.pwn(481) : error 017: undefined symbol "str" E:\Freeroam World\filterscripts\MAdmin.pwn(481) : error 017: undefined symbol "str" E:\Freeroam World\filterscripts\MAdmin.pwn(481) : error 029: invalid expression, assumed zero E:\Freeroam World\filterscripts\MAdmin.pwn(481) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 12 Errors.
dcmd_setadmin( playerid, params[ ] )
{
new
ID, levels, Nam[ MAX_PLAYER_NAME ], pname[ MAX_PLAYER_NAME ], str[ 128 ];
if( gPlayerInfo[ playerid ][ PLAYER_LEVEL ] < 5 ) return SendClientMessage( playerid, -1, "You need to be Admin Level 5 to use that command!" );
if( sscanf( params, "ri", ID, levels ) ) return SendClientMessage( playerid, 0xFF9900AA, "Usage: /setadmin [ID/Part Of Name] [Level 0-5]" );
if( levels > 5 || levels < 0) return SendClientMessage( playerid, -1, "LEVELS AVAILABLE 0-5!" );
if( ID == INVALID_PLAYER_ID )return SendClientMessage( playerid, -1, "That user is not connected." );
if( gPlayerInfo[ ID ][ PLAYER_LEVEL ] == levels ) return SendClientMessage( playerid, -1, "ERROR: That person is already this admin level!" );
GetPlayerName( playerid, Nam, MAX_PLAYER_NAME );
GetPlayerName( ID, pname, MAX_PLAYER_NAME );
if( levels == 0 )
{
format( str, sizeof( str ),"%s has demoted you to Admin Level 0 on the server. ", Nam );
SendClientMessage( ID, -1, str );
format( str, sizeof( str ), "You have demoted %s to Admin Level 0", pname );
SendClientMessage( playerid, -1, str );
gPlayerInfo[ ID ][ PLAYER_LEVEL ] = 0;
}
else
{
format( str, sizeof( str ), "%s has your Admin level to %d on the server.", Nam, levels );
SendClientMessage( ID, -1, str );
format( str, sizeof( str ), "You had set %s Admin level to %d!", pname, levels );
SendClientMessage( playerid, -1, str );
gPlayerInfo[ ID ][ PLAYER_LEVEL ] = levels;
}
return 1;
}
pawn Код:
|