SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 18/05/2020, 03:55 PM   #1
RainW
Little Clucker
 
RainW's Avatar
 
Join Date: Aug 2019
Posts: 38
Reputation: 0
Default /Unlockserver Command Correct?

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;
}
RainW is offline   Reply With Quote
Old 18/05/2020, 05:05 PM   #2
XStormiest
Gangsta
 
Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 558
Reputation: 46
Default Re: /Unlockserver Command Correct?

Yes, it is correct.
__________________
XStormiest is offline   Reply With Quote
Old 21/05/2020, 01:42 PM   #3
EternalDirection
Little Clucker
 
Join Date: May 2020
Location: South East Asia
Posts: 2
Reputation: 0
Default Re: /Unlockserver Command Correct?

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;
}
EternalDirection is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
This command still not working correct MayaEU Scripting Help 2 01/07/2016 11:48 AM
Command not working correct! andreistalker Scripting Help 7 09/08/2015 09:47 PM
Command not work correct. DovIIs Scripting Help 2 20/10/2014 07:11 PM
Correct Command Codes not working? +REP ShawtyyMacJunior Scripting Help 5 30/07/2012 09:22 AM
Correct layout for a /pay command? Luis- Scripting Help 1 27/02/2012 10:26 PM


All times are GMT. The time now is 09:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.