02.08.2011, 16:57
I am making an admin script but i don't know how to make admin lvls correcttly so please tell me.
I am making an admin script but i don't know how to make admin lvls correcttly so please tell me.
|
CMD:setadmin(playerid, params[])
{
new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin [id] [adminlevel]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid Admin Levels: 1-10!");
PlayerInfo[id][pAdminLevel] = admlvl;
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, adminname, sizeof(adminname));
new str[128];
format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
SendClientMessage(playerid,COLOR_GREEN,str);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED," You are not allowed to use this command!");
}
if(PlayerInfo[playerid][pAdminLevel] >=1)
CMD:jetpack(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=3)
{
SetPlayerSpecialAction(playerid, 2);
SendClientMessage(playerid,COLOR_GREEN, "|__Jetpack Spawned__|");
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, " You are not allowed to use this command");
}
CMD:admincommand(playerid, params[]) {
if(/* your admin level variable */ >= 3) {
SendClientMessage(playerid, 0, "You can use this command, you're a level 3+ admin, but it does nothing other than send this message.");
}
return 1;
}
With zcmd:
pawn Code:
|
if(PlayerInfo[playerid][pAdminLevel] >=1)
CMD:flip(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=1)
{
if (IsPlayerInAnyVehicle(playerid))
{
new VehicleID, Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
VehicleID = GetPlayerVehicleID(playerid);
SetVehiclePos(VehicleID, X, Y, Z);
SetVehicleZAngle(VehicleID, 0);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not in any vehicle");
}
else return SendClientMessage(playerid, COLOR_RED, " You are not allowed to use this command");
}
enum gPInfo { Logged, Regged, pAdminLevel }; |
C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(95) : error 017: undefined symbol "PInfo" C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(95) : warning 215: expression has no effect C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(95) : error 001: expected token: ";", but found "]" C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(95) : error 029: invalid expression, assumed zero C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(95) : fatal error 107: too many error messages on one line |
public OnPlayerConnect(playerid) { PInfo[playerid][Logged] = 0; PInfo[playerid][Regged] = 0;. PInfo[playerid][Level] = 0; new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"MyAdmin/Users/%s.txt",name); if(dini_Exists(file)) { SendClientMessage(playerid,LIGHTBLUE,"You are registered, Please /login!"); PInfo[playerid][Regged] = 1; PInfo[playerid][Logged] = 0; return 1; } if(!dini_Exists(file)) { SendClientMessage(playerid,LIGHTBLUE,"You are not registered, Please /register!"); PInfo[playerid][Regged] = 0; PInfo[playerid][Logged] = 0; return 1; } return 1; return 1; } |
C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(31) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYER_NAME") C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(101) : error 009: invalid array size (negative, zero or out of bounds) C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(101) : error 029: invalid expression, assumed zero C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(101) : error 017: undefined symbol "file" C:\Users\PART\Desktop\samp03csvr_R2-2_win32\filterscripts\ad_killerking.pwn(101) : fatal error 107: too many error messages on one line |
new name[MAX_PLAYER_NAME], file[256]; |