OMG! Maybe I deleted some letter or what.. wheres the problem?
Код:
if(strcmp(cmd, "/makeadmin", true) == 0) // Make player an admin
{
if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level 1-5]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin depending on the given level.");
return 1;
}
new giveplayerid = ReturnUser(tmp, playerid);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
if (level >= 0)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
printf("ADMIN: %s made %s a level %d admin.", sendername, giveplayername, level);
format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, sendername);
SendClientMessage(giveplayerid, LIGHTBLUE, string);
format(string, sizeof(string), "|- Administrator %s has given %s an Admin Level. [Level: %d] -|", sendername,giveplayername,level);
SendClientMessageToAdmins(ADMIN_RED, string, 1);
AccountInfo[giveplayerid][AdminLevel] = level;
format(string, sizeof(string), "You have given %s level %d admin.", giveplayername,AccountInfo[giveplayerid][AdminLevel]);
SendClientMessage(playerid, LIGHTBLUE, string);
}
else return SendClientMessage(playerid, RED, "You can't go below level 0!");
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%i is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not a lead admin!");
return 1;
}
if(strcmp(cmd, "/gmx", true) == 0) // Reboot the server
{
if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid)) return GameModeExit();
else return SendClientMessage(playerid, RED, "You are not a lead admin!");
}
if(strcmp(cmd, "/kickall", true) == 0) // Kick everyone except the one who does this
{
new reason[128];
if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason))
{
SendClientMessage(playerid, ORANGE, "USAGE: /kickall [reason]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will kick all the players.");
return 1;
}
printf("ADMIN: Admin %s kicked everyone. Reason: %s", sendername, reason);
format(string, sizeof(string), "-| Administrator %s kicked everyone. [Reason: %s ] |-", sendername,reason);
SendClientMessageToAll(ADMIN_RED, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (i != playerid)
{
Kick(i);
KickLog(string);
}
}
}
else SendClientMessage(playerid, RED, "You are not a lead admin!");
return 1;
}
if(strcmp(cmd, "/nuke", true) == 0) // Nuke a player (explode)
{
if (AccountInfo[playerid][AdminLevel] >= 3)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /nuke [playerid]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Player will explode.");
return 1;
}
new Float:X,Float:Y,Float:Z;
new giveplayerid = ReturnUser(tmp, playerid);
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(giveplayerid, X,Y,Z);
CreateExplosion(X,Y,Z,2,3.0);
SetPlayerHealth(giveplayerid, 0.0);
format(string, sizeof(string), "-| Administrator %s nuked %s |-",sendername,giveplayername);
SendClientMessageToAdmins(ADMIN_RED, string,1);
}
else if (!IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
return 1;
}
if(strcmp(cmd, "/angle", true) == 0) // Shows your current angle + sets it
{
if (IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
{
new Float:angle;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /angle [angle degree]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will change your current angle.");
GetPlayerFacingAngle(playerid,angle);
format(string, sizeof(string), "HELP: Your current angle is %f", angle);
SendClientMessage(playerid, ORANGE, string);
return 1;
}
angle = floatstr(tmp);
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
format(string, sizeof(string), "You have changed your angle degree to %f" ,angle);
SendClientMessage(playerid, GREEN, string);
}
else
{
SetPlayerFacingAngle(playerid,angle);
format(string, sizeof(string), "You have changed your angle degree to %f",angle);
SendClientMessage(playerid, GREEN, string);
}
}
else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
return 1;
}
if(strcmp(cmd, "/rangeban", true) == 0) // Range-bans a player with the amount of ranges entered.
{
if (AccountInfo[playerid][AdminLevel] >= 4)
{
tmp = strtok(cmdtext,idx);
if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /rangeban [playername/id] [ranges(2 max)]");
new ip[20],ban[128];
new giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
tmp = strtok(cmdtext,idx);
if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /rangeban [playername/id] [RANGES(2 max)]");
new ranges = strval(tmp);
if (ranges < 0 || ranges > 2) return SendClientMessage(playerid, RED, "Minimum ranges: 0 | Maximum ranges: 2");
if (ranges == 0)
{
Ban(giveplayerid);
}
GetPlayerName(giveplayerid, giveplayername, sizeof giveplayername);
GetPlayerIp(giveplayerid, ip, sizeof ip);
new count = 1;
for(new i = strlen(ip); i > 0; i--)
{
if (ip[i] == '.')
{
if (count == ranges)
{
format(ban, sizeof ban, "banip %s", ip);
SendRconCommand(ban);
break;
}
else count++;
}
else ip[i] = '*';
}
format(ban, sizeof ban, "%s has been banned with the ip '%s'", giveplayername, ip);
SendClientMessage(playerid, GREEN, ban);
}
else
{
format(string, sizeof(string), "%i is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You're not a lead admin !");
return 1;
}
if(strcmp(cmd, "/ip", true) == 0) // Look at the player's IP address
{
if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /ip [playername/id]");
SendClientMessage(playerid, ORANGE, "FUNCTION: View a player's IP.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
new sstring[256];
new ip[20];
GetPlayerIp(giveplayerid, ip, sizeof ip);
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
format(sstring, sizeof(sstring), "-| %s's IP: %s |-", giveplayername,ip);
SendClientMessage(playerid,LIGHTBLUE, sstring);
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not an admin.");
return 1;
}
if(strcmp(cmd, "/ban", true) == 0) // Bans a player from the server
{
new reason[128];
if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /ban [playername/id] [reason]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will BAN the specified player.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if (AccountInfo[giveplayerid][AdminLevel] > AccountInfo[playerid][AdminLevel])
{
format(string, sizeof(string), "-| [%i]%s tried to ban you! |-",playerid,sendername);
SendClientMessage(giveplayerid, ADMIN_RED,string);
SendClientMessage(playerid, ADMIN_RED, "You are not allowed to ban an admin with a higher level than you!");
}
else if (giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /ban [playername/id] [reason]");
new ip[20];
printf("ADMIN: Admin %s banned %s. Reason: %s", sendername, giveplayername, reason);
format(string, sizeof(string), "-| Administrator %s banned %s. [Reason: %s ] |-", sendername, giveplayername, reason);
SendClientMessageToAll(ADMIN_RED, string);
GetPlayerIp(giveplayerid, ip, sizeof ip);
format(string, sizeof(string), "-| Banned Player's IP: %s |-", ip);
SendClientMessageToAdmins(ADMIN_RED, string, 1);
AccountInfo[giveplayerid][AdminLevel] = 0; // Resets the banned player's admin level for security reasons
format(reason, sizeof reason, "[%s]%s", sendername, reason);
BanEx(giveplayerid, reason);
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
return 1;
}
if(strcmp(cmd, "/kick", true) == 0) // Kicks the player from the server
{
new reason[128];
if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /kick [playername/id] [reason]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will kick the specified player.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /kick [playername/id] [reason]");
printf("ADMIN: Admin %s kicked %s. Reason: %s", sendername, giveplayername, reason);
format(string, sizeof(string), "-| Administrator %s kicked %s. [Reason: %s ] |-", sendername, giveplayername, reason);
SendClientMessageToAll(ADMIN_RED, string);
Kick(giveplayerid);
KickLog(string);
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
return 1;
}
if(strcmp(cmd, "/mute", true) == 0) // Mutes the player from talking in the chat box
{
new reason[128];
if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /mute [playername/id] [reason]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will mute the specified player.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
if (AccountInfo[giveplayerid][Mute] == 0)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /mute [playername/id] [reason]");
printf("ADMIN: Admin %s muted %s. Reason: %s", sendername, giveplayername, reason);
format(string, sizeof(string), "-| Administrator %s muted %s. [Reason: %s ]|-", sendername,giveplayername,reason);
SendClientMessageToAll(ADMIN_RED, string);
AccountInfo[giveplayerid][Mute] = 1;
}
else if (AccountInfo[giveplayerid][Mute] == 1) SendClientMessage(playerid, RED, "Player is already muted!");
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
return 1;
}
Up..
please.. its IMPORTANT
Up.. pleeeaaasee