I have been posting some pretty recent threads due to my administrator script...
Last problem was the "dcmd_akill" Which i could not figure out, so i got rid of it.
The problem is....
When i compile my FS it comes up with a windows error saying it's crashed, un-responsive, or is not working...
So i got rid of the command making it do that.
I recently added another thing that makes a member/player an admin InGame. So i don't have to goto the Users folder and change their level, i can just type something like "/setadmin 42 2" [COMMAND] [ID] [LEVEL]
Here is the command not working.
I will paste it from the VERY top, to where the Command ends.
pawn Код:
//===============Mikes attempt to make a admin script==============//
// NOT THE BEST //
//===========================Includes==============================//
#include <a_samp>
#include <dini>
#include <dutils>
#include <sscanf2>
//===========================Pragma================================//
#pragma tabsize 0
#pragma unused ret_memcpy
//============================Enum=================================//
enum Info
{
AdminLevel,
}
new PlayerInfo[MAX_PLAYERS][Info];
enum PLAYER_MAIN
{
PLAYER_NAME[MAX_PLAYER_NAME],
PLAYER_IP[16],
PLAYER_REGGED,
PLAYER_PASS,
PLAYER_LOGGED,
PLAYER_LEVEL,
PLAYER_WIRED,
PLAYER_JAILED,
PLAYER_SETHP
}
enum SETTINGS_MAIN
{
POCKET_MONEY,
JAIL_COMMANDS,
ANNOUNCE_SECONDS,
PASS_MIN,
PASS_MAX
}
new gSettings[SETTINGS_MAIN];
new gPlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
enum COMMANDS_MAIN {
ANNOUNCE,
ARMOURALL,
BAN,
CARHP,
EXPLODE,
FLIP,
GOTO,
GETHERE,
GIVEARMOUR,
GIVEHEALTH,
GIVEWEAPON,
GOD,
HEALALL,
IMITATE,
IP,
KICK,
MAXAMMO,
PING,
SETLEVEL,
SETWANTED,
TBAN,
TIME,
WEATHER,
NUKE,
AJAIL,
SETHP
}
new gCommands[COMMANDS_MAIN];
//============================Defines==============================//
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define jail
#define COLOR_PM 0xFFFF2AFF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_ACTIVEBORDER 0xB4B4B4FF
#define COLOR_ACTIVECAPTION 0x99B4D1FF
#define COLOR_ACTIVECAPTIONTEXT 0x000000FF
#define COLOR_ALICEBLUE 0xF0F8FFFF
#define COLOR_ANTIQUEWHITE 0xFAEBD7FF
#define COLOR_APPWORKSPACE 0xABABABFF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_AQUAMARINE 0x7FFFD4FF
#define COLOR_AZURE 0xF0FFFFFF
#define COLOR_BEIGE 0xF5F5DCFF
#define COLOR_BISQUE 0xFFE4C4FF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLANCHEDALMOND 0xFFEBCDFF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BLUEVIOLET 0x8A2BE2FF
#define COLOR_BROWN 0xA52A2AFF
#define COLOR_BURLYWOOD 0xDEB887FF
#define COLOR_BUTTONFACE 0xF0F0F0FF
#define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
#define COLOR_BUTTONSHADOW 0xA0A0A0FF
#define COLOR_CADETBLUE 0x5F9EA0FF
#define COLOR_CHARTREUSE 0x7FFF00FF
#define COLOR_CHOCOLATE 0xD2691EFF
#define COLOR_CONTROL 0xF0F0F0FF
#define COLOR_CONTROLDARK 0xA0A0A0FF
#define COLOR_CONTROLDARKDARK 0x696969FF
#define COLOR_CONTROLLIGHT 0xE3E3E3FF
#define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
#define COLOR_CONTROLTEXT 0x000000FF
#define COLOR_CORAL 0xFF7F50FF
#define COLOR_CORNFLOWERBLUE 0x6495EDFF
#define COLOR_CORNSILK 0xFFF8DCFF
#define COLOR_CRIMSON 0xDC143CFF
#define COLOR_CYAN 0x00FFFFFF
#define COLOR_DARKBLUE 0x00008BFF
#define COLOR_DARKCYAN 0x008B8BFF
#define COLOR_DARKGOLDENROD 0xB8860BFF
#define COLOR_DARKGRAY 0xA9A9A9FF
#define COLOR_DARKGREEN 0x006400FF
#define COLOR_DARKKHAKI 0xBDB76BFF
#define COLOR_DARKMAGENTA 0x8B008BFF
#define COLOR_DARKOLIVEGREEN 0x556B2FFF
#define COLOR_DARKORANGE 0xFF8C00FF
#define COLOR_DARKORCHID 0x9932CCFF
#define COLOR_DARKRED 0x8B0000FF
#define COLOR_DARKSALMON 0xE9967AFF
#define COLOR_DARKSEAGREEN 0x8FBC8BFF
#define COLOR_DARKSLATEBLUE 0x483D8BFF
#define COLOR_DARKSLATEGRAY 0x2F4F4FFF
#define COLOR_DARKTURQUOISE 0x00CED1FF
#define COLOR_DARKVIOLET 0x9400D3FF
#define COLOR_DEEPPINK 0xFF1493FF
#define COLOR_DEEPSKYBLUE 0x00BFFFFF
#define COLOR_DESKTOP 0x000000FF
#define COLOR_DIMGRAY 0x696969FF
#define COLOR_DODGERBLUE 0x1E90FFFF
#define COLOR_FIREBRICK 0xB22222FF
#define COLOR_FLORALWHITE 0xFFFAF0FF
#define COLOR_FORESTGREEN 0x228B22FF
#define COLOR_FUCHSIA 0xFF00FFFF
#define COLOR_GAINSBORO 0xDCDCDCFF
#define COLOR_GHOSTWHITE 0xF8F8FFFF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_GOLDENROD 0xDAA520FF
#define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
#define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
#define COLOR_GRAY 0x808080FF
#define COLOR_GRAYTEXT 0x808080FF
#define COLOR_GREEN 0x008000FF
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_HIGHLIGHT 0x3399FFFF
#define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
#define COLOR_HONEYDEW 0xF0FFF0FF
#define COLOR_HOTPINK 0xFF69B4FF
#define COLOR_HOTTRACK 0x0066CCFF
#define COLOR_INACTIVEBORDER 0xF4F7FCFF
#define COLOR_INACTIVECAPTION 0xBFCDDBFF
#define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
#define COLOR_INDIANRED 0xCD5C5CFF
#define COLOR_INDIGO 0x4B0082FF
#define COLOR_INFO 0xFFFFE1FF
#define COLOR_INFOTEXT 0x000000FF
#define COLOR_IVORY 0xFFFFF0FF
#define COLOR_KHAKI 0xF0E68CFF
#define COLOR_LAVENDER 0xE6E6FAFF
#define COLOR_LAVENDERBLUSH 0xFFF0F5FF
#define COLOR_LAWNGREEN 0x7CFC00FF
#define COLOR_LEMONCHIFFON 0xFFFACDFF
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_LIGHTCORAL 0xF08080FF
#define COLOR_LIGHTCYAN 0xE0FFFFFF
#define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
#define COLOR_LIGHTGRAY 0xD3D3D3FF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_LIGHTPINK 0xFFB6C1FF
#define COLOR_LIGHTSALMON 0xFFA07AFF
#define COLOR_LIGHTSEAGREEN 0x20B2AAFF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_LIGHTSLATEGRAY 0x778899FF
#define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
#define COLOR_LIGHTYELLOW 0xFFFFE0FF
#define COLOR_LIME 0x00FF00FF
#define COLOR_LIMEGREEN 0x32CD32FF
#define COLOR_LINEN 0xFAF0E6FF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_MAROON 0x800000FF
#define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
#define COLOR_MEDIUMBLUE 0x0000CDFF
#define COLOR_MEDIUMORCHID 0xBA55D3FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_MEDIUMSEAGREEN 0x3CB371FF
#define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
#define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
#define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
#define COLOR_MEDIUMVIOLETRED 0xC71585FF
#define COLOR_MENU 0xF0F0F0FF
#define COLOR_MENUBAR 0xF0F0F0FF
#define COLOR_MENUHIGHLIGHT 0x3399FFFF
#define COLOR_MENUTEXT 0x000000FF
#define COLOR_MIDNIGHTBLUE 0x191970FF
#define COLOR_MINTCREAM 0xF5FFFAFF
#define COLOR_MISTYROSE 0xFFE4E1FF
#define COLOR_MOCCASIN 0xFFE4B5FF
#define COLOR_NAVAJOWHITE 0xFFDEADFF
#define COLOR_NAVY 0x000080FF
#define COLOR_OLDLACE 0xFDF5E6FF
#define COLOR_OLIVE 0x808000FF
#define COLOR_OLIVEDRAB 0x6B8E23FF
#define COLOR_ORANGE 0xFFA500FF
#define COLOR_ORANGERED 0xFF4500FF
#define COLOR_ORCHID 0xDA70D6FF
#define COLOR_PALEGOLDENROD 0xEEE8AAFF
#define COLOR_PALEGREEN 0x98FB98FF
#define COLOR_PALETURQUOISE 0xAFEEEEFF
#define COLOR_PALEVIOLETRED 0xDB7093FF
#define COLOR_PAPAYAWHIP 0xFFEFD5FF
#define COLOR_PEACHPUFF 0xFFDAB9FF
#define COLOR_PERU 0xCD853FFF
#define COLOR_PINK 0xFFC0CBFF
#define COLOR_PLUM 0xDDA0DDFF
#define COLOR_POWDERBLUE 0xB0E0E6FF
#define COLOR_PURPLE 0x800080FF
#define COLOR_RED 0xFF0000FF
#define COLOR_ROSYBROWN 0xBC8F8FFF
#define COLOR_ROYALBLUE 0x4169E1FF
#define COLOR_SADDLEBROWN 0x8B4513FF
#define COLOR_SALMON 0xFA8072FF
#define COLOR_SANDYBROWN 0xF4A460FF
#define COLOR_SCROLLBAR 0xC8C8C8FF
#define COLOR_SEAGREEN 0x2E8B57FF
#define COLOR_SEASHELL 0xFFF5EEFF
#define COLOR_SIENNA 0xA0522DFF
#define COLOR_SILVER 0xC0C0C0FF
#define COLOR_SKYBLUE 0x87CEEBFF
#define COLOR_SLATEBLUE 0x6A5ACDFF
#define COLOR_SLATEGRAY 0x708090FF
#define COLOR_SNOW 0xFFFAFAFF
#define COLOR_SPRINGGREEN 0x00FF7FFF
#define COLOR_STEELBLUE 0x4682B4FF
#define COLOR_TAN 0xD2B48CFF
#define COLOR_TEAL 0x008080FF
#define COLOR_THISTLE 0xD8BFD8FF
#define COLOR_TOMATO 0xFF6347FF
#define COLOR_TRANSPARENT 0xFFFFFF00
#define COLOR_TURQUOISE 0x40E0D0FF
#define COLOR_VIOLET 0xEE82EEFF
#define COLOR_WHEAT 0xF5DEB3FF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_WHITESMOKE 0xF5F5F5FF
#define COLOR_WINDOW 0xFFFFFFFF
#define COLOR_WINDOWFRAME 0x646464FF
#define COLOR_WINDOWTEXT 0x000000FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_YELLOWGREEN 0x9ACD32FF
#define STEALTH_ORANGE 0xFF880000
#define STEALTH_OLIVE 0x66660000
#define STEALTH_GREEN 0x33DD1100
#define STEALTH_PINK 0xFF22EE00
#define STEALTH_BLUE 0x0077BB00
//=======================================//
#define PlayerFile "AdminScript/Users/%s.ini"
#define SettingFile "AdminScript/Settings/MainSettings.ini"
#define CommandFile "AdminScript/Settings/Commands.ini"
//=================================================================//
public OnFilterScriptInit()
{
print("\n****************************************");
print(" Admin Filterscript By Mike Dunne. ");
print(" His first time. ");
print(" SUCK MAHHH DECKKKK BITCHHHEZZZZZZZZZZZ. ");
print("****************************************\n");
// Level 1 = New Admin
// Level 2 = Known Admin
// Level 3 = Trusted Admin
// Level 4 = Lead Admin
// Level 5 = LeaderAdmin/ServerOwner
if(!fexist(SettingFile))
{
dini_Create(SettingFile);
dini_IntSet(SettingFile, "PocketMoney", 3000);
dini_IntSet(SettingFile, "JailCommands", 0);
dini_IntSet(SettingFile, "AnnounceSeconds", 3);
dini_IntSet(SettingFile, "PassMin", 3);
dini_IntSet(SettingFile, "PassMax", 15);
}
gSettings[POCKET_MONEY] = dini_Int(SettingFile, "PocketMoney");
gSettings[JAIL_COMMANDS] = dini_Int(SettingFile, "JailCommands");
gSettings[ANNOUNCE_SECONDS] = dini_Int(SettingFile, "AnnounceSeconds");
gSettings[PASS_MIN] = dini_Int(SettingFile, "PassMin");
gSettings[PASS_MAX] = dini_Int(SettingFile, "PassMax");
if(!fexist(CommandFile))
{
dini_Create(CommandFile);
dini_IntSet(CommandFile, "Announce", 5);
dini_IntSet(CommandFile, "Armourall", 3);
dini_IntSet(CommandFile, "Ban", 2);
dini_IntSet(CommandFile, "Carhp", 2);
dini_IntSet(CommandFile, "Explode", 3);
dini_IntSet(CommandFile, "Goto", 1);
dini_IntSet(CommandFile, "Gethere", 1);
dini_IntSet(CommandFile, "Givearmour", 2);
dini_IntSet(CommandFile, "Givehealth", 2);
dini_IntSet(CommandFile, "Giveweapon", 2);
dini_IntSet(CommandFile, "God", 5);
dini_IntSet(CommandFile, "Healall", 3);
dini_IntSet(CommandFile, "Imitate", 3);
dini_IntSet(CommandFile, "Ip", 1);
dini_IntSet(CommandFile, "Kick", 1);
dini_IntSet(CommandFile, "Maxammo", 3);
dini_IntSet(CommandFile, "Ping", 1);
dini_IntSet(CommandFile, "Setlevel", 5);
dini_IntSet(CommandFile, "Setwanted", 1);
dini_IntSet(CommandFile, "Tban", 3);
dini_IntSet(CommandFile, "Time", 1);
dini_IntSet(CommandFile, "Weather", 2);
}
gCommands[ANNOUNCE] = dini_Int(CommandFile, "Announce");
gCommands[ARMOURALL] = dini_Int(CommandFile, "Armourall");
gCommands[BAN] = dini_Int(CommandFile, "Ban");
gCommands[CARHP] = dini_Int(CommandFile, "Carhp");
gCommands[EXPLODE] = dini_Int(CommandFile, "Explode");
gCommands[GOTO] = dini_Int(CommandFile, "Goto");
gCommands[GETHERE] = dini_Int(CommandFile, "Gethere");
gCommands[GIVEARMOUR] = dini_Int(CommandFile, "Givearmour");
gCommands[GIVEHEALTH] = dini_Int(CommandFile, "Givehealth");
gCommands[GIVEWEAPON] = dini_Int(CommandFile, "Giveweapon");
gCommands[GOD] = dini_Int(CommandFile, "God");
gCommands[HEALALL] = dini_Int(CommandFile, "Healall");
gCommands[IMITATE] = dini_Int(CommandFile, "Imitate");
gCommands[IP] = dini_Int(CommandFile, "Ip");
gCommands[KICK] = dini_Int(CommandFile, "Kick");
gCommands[MAXAMMO] = dini_Int(CommandFile, "Maxammo");
gCommands[SETLEVEL] = dini_Int(CommandFile, "Setlevel");
gCommands[SETWANTED] = dini_Int(CommandFile, "Setwanted");
gCommands[TBAN] = dini_Int(CommandFile, "Tban");
gCommands[TIME] = dini_Int(CommandFile, "Time");
gCommands[WEATHER] = dini_Int(CommandFile, "Weather");
gCommands[NUKE] = dini_Int(CommandFile, "Nuke");
gCommands[AJAIL] = dini_Int(CommandFile, "jail");
gCommands[SETHP] = dini_Int(CommandFile, "Sethp");
return 1;
}
#endif
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][AdminLevel] = 0;
return 1;
}
new file[100],Name[MAX_PLAYER_NAME],Ip[16];
GetPlayerName(playerid,Name,sizeof(Name));
GetPlayerIp(playerid,Ip,sizeof(Ip));
format(file,sizeof(file),PlayerFile,Name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"Name",Name);
dini_Set(file,"Ip",Ip);
dini_IntSet(file,"Registered",-1);
dini_IntSet(file,"Password",0);
dini_IntSet(file,"Level",0);
dini_IntSet(file,"Wired",0);
dini_IntSet(file,"Jailed",0);
SendClientMessage(playerid,COLOR_ORANGE,"Your username is not recognized on this server. Please /register to continue.");
}
strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file,"Name"));
strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file,"Ip"));
gPlayerInfo[playerid][PLAYER_REGGED] = dini_Int(file,"Registered");
gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file,"Password");
gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file,"Level");
gPlayerInfo[playerid][PLAYER_WIRED] = dini_Int(file,"Wired");
gPlayerInfo[playerid][PLAYER_JAILED] = dini_Int(file,"Jailed");
gPlayerInfo[playerid][PLAYER_SETHP] = dini_Int(file,"Sethp");
if(gPlayerInfo[playerid][PLAYER_REGGED] == 0) SendClientMessage(playerid,COLOR_ORANGE,"You're username is recognised on this server, but you have not registered. Please /register to continue.");
else if(gPlayerInfo[playerid][PLAYER_REGGED] == 1) SendClientMessage(playerid,COLOR_ORANGE,"You're username is recognised on this server. Please /login to continue.");
gPlayerInfo[playerid][PLAYER_REGGED] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[100];
format(file,sizeof(file),PlayerFile,gPlayerInfo[playerid][PLAYER_NAME]);
dini_Set(file,"Name",gPlayerInfo[playerid][PLAYER_NAME]);
dini_Set(file,"Ip",gPlayerInfo[playerid][PLAYER_IP]);
dini_IntSet(file,"Registered",gPlayerInfo[playerid][PLAYER_REGGED]);
dini_IntSet(file,"Password",gPlayerInfo[playerid][PLAYER_PASS]);
dini_IntSet(file,"Level",gPlayerInfo[playerid][PLAYER_LEVEL]);
dini_IntSet(file,"Wired",gPlayerInfo[playerid][PLAYER_WIRED]);
dini_IntSet(file,"Jailed",gPlayerInfo[playerid][PLAYER_JAILED]);
dini_IntSet(file,"Sethp",gPlayerInfo[playerid][PLAYER_SETHP]);
gPlayerInfo[playerid][PLAYER_NAME] = 0;
gPlayerInfo[playerid][PLAYER_IP] = 0;
gPlayerInfo[playerid][PLAYER_REGGED] = 0;
gPlayerInfo[playerid][PLAYER_LOGGED] = 0;
gPlayerInfo[playerid][PLAYER_PASS] = 0;
gPlayerInfo[playerid][PLAYER_LEVEL] = 0;
gPlayerInfo[playerid][PLAYER_WIRED] = 0;
gPlayerInfo[playerid][PLAYER_JAILED] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(register, 8, cmdtext);
dcmd(login, 5, cmdtext);
dcmd(logout, 6, cmdtext);
dcmd(password, 8, cmdtext);
dcmd(announce, 8, cmdtext);
dcmd(ban, 3, cmdtext);
dcmd(slap, 4, cmdtext);
dcmd(getplayer, 7, cmdtext);
dcmd(kick, 4, cmdtext);
dcmd(nuke,4,cmdtext);
dcmd(ajail,5,cmdtext);
dcmd(heal,4,cmdtext);
dcmd(sethp,5,cmdtext);
dcmd(setscore,8,cmdtext);
return 0;
}
//Start of code (The command/code stopping pawn compiler, failing it.)
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/makeadmin", true) == 0)
{
new string[128];
new tmp[256];
new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
if (IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin.");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, player, sizeof(player));
PlayerInfo[giveplayerid][AdminLevel] = level;
printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player);
SendClientMessage(giveplayerid, 0x00C2ECFF, string);
format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
SendClientMessage(playerid, 0x00C2ECFF, string);
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%i is not an active player.", giveplayerid);
SendClientMessage(playerid, 0xE60000FF, string);
}
}
else
{
SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
}
return 1;
} //End of code
Where i got this command from is from this website...