/Unlockserver Command Correct?
#1

Hello i created my /unlockserver Command

is this Correct?

Code:
CMD:unlockserver(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 99999)
{
	new string[128],name[50];
	GetPlayerName(playerid,name,sizeof(name));
//    if(ServerLocked)
    {
//        ServerLocked = false;
        SendRconCommand("password 0");
		SendRconCommand("hostname Neterval Roleplay ");
		format(string, sizeof(string), "{FF0000}ADMCMD:{FF6347}Server Director %s unlocked the server.",name);
		SendClientMessageToAll(COLOR_WHITE, string);
		
    }
}
else return SendClientMessage(playerid, COLOR_RED, "   You are not authorized to use this Command!");
return 1;
}
Reply
#2

Yes, it is correct.
Reply
#3

No, it is not. You shouldn't have commented line 7 on that code.

Here, it is the optimized one:
Code:
CMD:unlockserver(playerid, params[]) {
    if (PlayerInfo[playerid][pAdmin] == 99999) {
        if (ServerLocked) {
            new string[87], name[24];
            GetPlayerName(playerid, name, sizeof(name));
            ServerLocked = false; // unlock
            SendRconCommand("password 0");
            SendRconCommand("hostname Neterval Roleplay");
            format(string, sizeof(string), "{FF0000}ADMCMD:{FF6347}Server Director %s unlocked the server.", name);
            SendClientMessageToAll(COLOR_WHITE, string);
        } else
            SendClientMessage(playerid, COLOR_WHITE, "The server is not locked.");
    } else
        SendClientMessage(playerid, COLOR_RED, "   You are not authorized to use this command!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)