Un-authorized command
#1

i have made a restart command,the problem is the it keeps telling me that im using an un-authorized command when i type the command ingame,i have the pScripter = 2 Rank ingame and it still tells me im un-authorized,please help me

Код:
CMD:gmx(playerid, params[])
{
    if(PlayerInfo[playerid][pScripter] || PlayerInfo[playerid][pAdmin] > 99999) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
    SetTimer( "Maintenance", 50000, false );
    SendClientMessageToAll(COLOR_LIGHTBLUE, "* The Server Will Be Going For Server Maintenance In 50Seconds.");
    foreach(Player, i) {
        GameTextForPlayer(i, "~y~Scheduled Maintenance 50Seconds", 5000, 3);
    }
    return 1;
}
Reply
#2

You need to verify what pScripter variable should be to be able to use this command.
Like this:
pawn Код:
if(PlayerInfo[playerid][pScripter] > 2  || PlayerInfo[playerid][pAdmin] > 99999)
Reply
#3

you're treating the pScripter as a boolean which will return false for a value of 0 or true for any other value so if it equals 2 then it'll return true
Reply
#4

Quote:

PlayerInfo[playerid][pAdmin] > 99999

Thats if they are Greater than 99999

Add a = after the >

Providing your pScripter is = 1 and your Admin Level is 99999
Reply
#5

SetTimer( "Maintenance", 50000, false ); this is not 50 seconds.
Reply
#6

i Did that in the earlier Try, and it still didn't work.

I tried also If(PlayerInfo[playerid][pScripter] >= 1 .......
and still gave the same unauthorized
Reply
#7

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
SetTimer( "Maintenance", 50000, false ); this is not 50 seconds.
sure it is since it's in milliseconds

also instead of looping through and using GameTextForPlayer you could just use GameTextForAll
Reply
#8

Quote:
Originally Posted by cessil
Посмотреть сообщение
sure it is since it's in milliseconds

also instead of looping through and using GameTextForPlayer you could just use GameTextForAll
No it's not, try running this and you will see that timers have absolutely zero precision I get about 4 seconds longer per minute.

pawn Код:
new TimerTicks;
CMD:testtimer(playerid, arg[])
{
    TimerTicks = GetTickCount();
    SetTimerEx("TimeTest", 60000, false, "i", playerid);
    return 1;
}

forward TimeTest(playerid);
public TimeTest(playerid)
{
    TimerTicks = GetTickCount() - TimerTicks;
    new line[128];
    format(line, sizeof(line), "60000ms timer was actually %i MS", TimerTicks);
    SendClientMessage(playerid, 0xFF00FFFF, line);
}
Reply
#9

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
No it's not, try running this and you will see that timers have absolutely zero precision I get about 4 seconds longer per minute.
his problem wasn't about precision it's about him not understanding a simple if statement

Quote:
Originally Posted by mahdi499
Посмотреть сообщение
i Did that in the earlier Try, and it still didn't work.

I tried also If(PlayerInfo[playerid][pScripter] >= 1 .......
and still gave the same unauthorized
of course because his pScripter is 2 which is also true so it'll return that message because 2 is greater than 1
Reply
#10

Quote:
Originally Posted by cessil
Посмотреть сообщение
his problem wasn't about precision it's about him not understanding a simple if statement



of course because his pScripter is 2 which is also true so it'll return that message because 2 is greater than 1
I made this timer to be just a warning i don't want it to be accurate,and i do know this is not 50 seconds,but all i cared about is sending the message,

Also thanks for explaining why it was giving unauthorized and im really thankful For your help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)