SA-MP Forums Archive
server restart announce - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: server restart announce (/showthread.php?tid=277424)



server restart announce - uprp - 17.08.2011

if(strcmp(cmd, "/announcerestart", true) == 0)
{
SendClientMessageToAll(playerid, COLOR_BLUE, " An administrator announced a server restart, You have 30 seconds to park/land your vehicles!");
}
}
return 1;
}






I wanna make a cmd, that lets admins over level 1337 admin do /announcerestart, and An administrator announced a server restart, You have 30 seconds to park/land your vehicles << SHOWS UP.

Maybe even if i can make it auto-gmx after that, would be nice.

I'ma newbie, but dont say i shouldnt try


Re: server restart announce - Kush - 17.08.2011

Quote:
Originally Posted by uprp
Посмотреть сообщение
if(strcmp(cmd, "/announcerestart", true) == 0)
{
SendClientMessageToAll(playerid, COLOR_BLUE, " An administrator announced a server restart, You have 30 seconds to park/land your vehicles!");
}
}
return 1;
}






I wanna make a cmd, that lets admins over level 1337 admin do /announcerestart, and An administrator announced a server restart, You have 30 seconds to park/land your vehicles << SHOWS UP.

Maybe even if i can make it auto-gmx after that, would be nice.

I'ma newbie, but dont say i shouldnt try
PHP код:
if(strcmp(cmd"/announcerestart"true) == 0)
{
    if(
PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playeridCOLOR_BLUE" You are not authorized to use that command");
    
SendClientMessageToAll(playeridCOLOR_BLUE" An administrator announced a server restart, You have 30 seconds to park/land your vehicles!");
    
SendRconCommand("gmx");
    return 
1;

Would you like a 30 second timer to start once the command is executed for GMX?


Re: server restart announce - Cameltoe - 17.08.2011

My first suggestion :
pawn Код:
command(announcerestart, playerid, params[])
{
     new string[ 128 ];
     if(YOURGETADMINFUNCTIONHERE(playerid) < DESIREDADMINLEVEL) return SendClientMessage(playerid, 0x0, "You need to be at least DESIREDADMINLEVEL to use this command");
     format(string, sizeof(string), "Admin : %s [ %d ] has announced an restart, please park / land your vehicles.");
     SendClientMessageToAll(0x0, string);
     return SetTimer("OnGmxRestart", 30 * 1000, false); // Not sure if you could use SetTimerEx and call SendRconCommand("gmx");  inside it.
} // Zcmd
Then the function called by SetTimer,

pawn Код:
forward OnGmxRestart();
public OnGmxRestart()
{
     return SendRconCommand("gmx");
}



Kush - uprp - 17.08.2011

Quote:
Originally Posted by Kush
Посмотреть сообщение
PHP код:
if(strcmp(cmd"/announcerestart"true) == 0)
{
    if(
PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playeridCOLOR_BLUE" You are not authorized to use that command");
    
SendClientMessageToAll(playeridCOLOR_BLUE" An administrator announced a server restart, You have 30 seconds to park/land your vehicles!");
    
SendRconCommand("gmx");
    return 
1;

Would you like a 30 second timer to start once the command is executed for GMX?
Yes. i need announcement, then 30 secs, boom GMX

Quote:
Originally Posted by Kush
Посмотреть сообщение
PHP код:
if(strcmp(cmd"/announcerestart"true) == 0)
{
    if(
PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playeridCOLOR_BLUE" You are not authorized to use that command");
    
SendClientMessageToAll(playeridCOLOR_BLUE" An administrator announced a server restart, You have 30 seconds to park/land your vehicles!");
    
SendRconCommand("gmx");
    return 
1;

Would you like a 30 second timer to start once the command is executed for GMX?
Quote:
Originally Posted by uprp
Посмотреть сообщение
Yes. i need announcement, then 30 secs, boom GMX
error 033: array must be indexed (variable "-unknown-")
error 035: argument type mismatch (argument 2)


Respuesta: server restart announce - uprp - 17.08.2011

error 033: array must be indexed (variable "-unknown-")
error 035: argument type mismatch (argument 2)
warning 217: loose indentation
error 029: invalid expression, assumed zero
error 017: undefined symbol "OnServerGMX"
error 029: invalid expression, assumed zero
error 017: undefined symbol "OnServerGMX"
warning 225: unreachable code
warning 217: loose indentation

Errors


Re: Respuesta: server restart announce - Kush - 17.08.2011

Quote:
Originally Posted by uprp
Посмотреть сообщение
error 033: array must be indexed (variable "-unknown-")
error 035: argument type mismatch (argument 2)
warning 217: loose indentation
error 029: invalid expression, assumed zero
error 017: undefined symbol "OnServerGMX"
error 029: invalid expression, assumed zero
error 017: undefined symbol "OnServerGMX"
warning 225: unreachable code
warning 217: loose indentation

Errors
Place the function before the command.


Re: Respuesta: server restart announce - Kingunit - 18.08.2011

Quote:
Originally Posted by uprp
Посмотреть сообщение
error 033: array must be indexed (variable "-unknown-")
error 035: argument type mismatch (argument 2)
warning 217: loose indentation
error 029: invalid expression, assumed zero
error 017: undefined symbol "OnServerGMX"
error 029: invalid expression, assumed zero
error 017: undefined symbol "OnServerGMX"
warning 225: unreachable code
warning 217: loose indentation

Errors
About the 'loose indentation'. Don't mess with the TABS>


Respuesta: server restart announce - uprp - 18.08.2011

Okay, can anyone just send me the full code. please


AW: server restart announce - umarmalik - 18.08.2011

Here we go

Код:
if (strcmp(cmd, "/restart", true) == 0)
	{
        if(IsPlayerConnected(playerid))
	    {
            if (PlayerInfo[playerid][pAdmin] < 3)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You're not the Admin !");
                return 1;
            }
			OOCOff(COLOR_ORANGE,"[OOC]  RolePlay Bot: An administrator announced a server restart, You have 30 seconds to park/land your vehicles!");
		}
		return 1;
	}
I hope thats work for you.


Re: server restart announce - Cameltoe - 18.08.2011

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
My first suggestion :
pawn Код:
command(announcerestart, playerid, params[])
{
     new string[ 128 ];
     if(YOURGETADMINFUNCTIONHERE(playerid) < DESIREDADMINLEVEL) return SendClientMessage(playerid, 0x0, "You need to be at least DESIREDADMINLEVEL to use this command");
     format(string, sizeof(string), "Admin : %s [ %d ] has announced an restart, please park / land your vehicles.");
     SendClientMessageToAll(0x0, string);
     return SetTimer("OnGmxRestart", 30 * 1000, false); // Not sure if you could use SetTimerEx and call SendRconCommand("gmx");  inside it.
} // Zcmd
Then the function called by SetTimer,

pawn Код:
forward OnGmxRestart();
public OnGmxRestart()
{
     return SendRconCommand("gmx");
}
I already did, and i'm pretty sure it would work.