How would i do this?
#1

How would i start a timer for the amount of time the person typed in after the command?

So like: SetTimerEx("Bla", params, 0, "i", playerid);

Like that, How would i do it correctly?
Reply
#2

Do you want it in minutes or seconds, because timers use milliseconds. If you want seconds, multiply the input by 1000, if you want minutes, multiply by 60000. Remember to use strval for params.
Reply
#3

Quote:
Originally Posted by biltong
Do you want it in minutes or seconds, because timers use milliseconds. If you want seconds, multiply the input by 1000, if you want minutes, multiply by 60000. Remember to use strval for params.
I want it in miliseconds,
still dosent answer my question though,

How would i set a timer for the time the player puts after the command?
Reply
#4

new time = strval(params);
SetTimerEx("bla", time, 0, "i", playerid);

Should work.
Reply
#5

I dont use strval cause i cant the way im doing it but it sitll works the same,
Anyway thats not working - btw i using sscanf
Reply
#6

Quote:
Originally Posted by Joe Torran C
I dont use strval cause i cant the way im doing it but it sitll works the same,
Anyway thats not working - btw i using sscanf
0o


new time;
if(sscanf(params, "i", time)) return SendClientMessage(playerid, 0xFFFFFFFF, "You didn't specify a time!");
else SetTimerEx("bla", time, 0, "i", playerid);

If that doesn't work, I don't know what will.
Reply
#7

Quote:
Originally Posted by biltong
Quote:
Originally Posted by Joe Torran C
I dont use strval cause i cant the way im doing it but it sitll works the same,
Anyway thats not working - btw i using sscanf
0o


new time;
if(sscanf(params, "i", time)) return SendClientMessage(playerid, 0xFFFFFFFF, "You didn't specify a time!");
else SetTimerEx("bla", time, 0, "i", playerid);

If that doesn't work, I don't know what will.
1. Yeah that dosent work..
2. Anyone else know?
Reply
#8

Maybe showing the code, so we can see what you're doing wrong ?
Reply
#9

pawn Код:
CMD:jail(playerid, params[])
{
    new id, time, reason[128];
    new string[128];
    if(!(BaseInfo[playerid][AdminLevel] > 1)) return SendClientMessage(playerid, COLOR_RED, "You are not an administrator with the required level");
    if(sscanf(params, "uiz", id, time, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /jail [PlayerID/PartOfName] [Time] [Reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player not Found");
    if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "Cannot jail Yourself");
    if(BaseInfo[id][AdminLevel] > 4) return SendClientMessage(playerid, COLOR_RED, "Cannot jail the Highest Level Admin");
   
    if(!reason[0]) {
        format(string, sizeof string, "Administrator %s has jailed %s for %i miliseconds", GetPlayersName(playerid), GetPlayersName(id), time);
        SendClientMessageToAll(COLOR_BLUE, string);

        SetTimerEx("Unjail", time, 0, "i", playerid);
        JailPlayer(id);
        return BaseInfo[id][Jailed] = 1;
    }
   
    format(string, sizeof string, "Administrator %s has jailed %s for %i miliseconds with reason: %s", GetPlayersName(playerid), GetPlayersName(id), time, reason);
    SendClientMessageToAll(COLOR_BLUE, string);

  SetTimerEx("Unjail", time, 0, "i", playerid);
    BaseInfo[id][Jailed] = 1;
    JailPlayer(id);
    return 1;
}
Reply
#10

You're trying to unjail 'playerid' (which typed the command) instead of 'id' (which got jailed)
Reply


Forum Jump:


Users browsing this thread: