server restart announce
#1

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
Reply
#2

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?
Reply
#3

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");
}
Reply
#4

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)
Reply
#5

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
Reply
#6

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.
Reply
#7

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>
Reply
#8

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

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)