Can somebody make me a gmx command
#1

Can somebody make me a gmx command mine isnt working i dont know why ... :S
Reply
#2

pawn Код:
// ZCMD
CMD:restart(playerid, params[])
{
    SendRconCommand("gmx");
    return 1;
}
Reply
#3

I think if you send the RCON command directly OnGameModeExit won't call properly, It happened to me where not all player data would save properly, if that's the case, use a more safe version:
pawn Код:
// ZCMD
CMD:restart(playerid, params[])
{
    OnGameModeExit();
    return 1;
}
Reply
#4

tnx a lot
Reply
#5

Quote:
Originally Posted by admantis
Посмотреть сообщение
I think if you send the RCON command directly OnGameModeExit won't call properly, It happened to me where not all player data would save properly, if that's the case, use a more safe version:
pawn Код:
// ZCMD
CMD:restart(playerid, params[])
{
    OnGameModeExit();
    return 1;
}
pawn Код:
CMD:restart(playerid, params[])
{
    foreach(Player,i)
    {
        SavePlayer(i);
    }
    SendRconCommand("gmx");
    return 1;
}
In that case you could save the players before restarting. But I've never done it the way you do, I'll try it.
The 'SavePlayer()' function is just for this example.
Reply
#6

@Tee, Yes but, you should make it more secure as in:
pawn Код:
CMD:restart(playerid, params[])
{
    foreach(Player,i)
    {
        if(IsPlayerConnected(i))
        {
            SavePlayer(i);
        }
    }
    SendRconCommand("gmx");
    return 1;
}
Therefore making it more secure, to the on-line players.
Reply
#7

People forget to do that, so foreach does it for them, therefore no need to create a check for connected players.
Reply
#8

pawn Код:
CMD:restart(playerid, params[])
{
    if(IsPlayerAdmin(playerid) {
        foreach(Player,i)
        {
            SavePlayer(i);
        }
        SendRconCommand("gmx");
    }
    return 1;
}
Talking about adding a little security..
Reply
#9

It would've been nice if you guys kept this The 'SavePlayer()' function is just for this example. in the quotes to prevent people viewing it to have problems.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)