time %i
#5

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Do not make script request threads, this is like the most simplest things to make.

pawn Код:
//Top of script
forward PlayerJailed();
new PlayerIsJailed[MAX_PLAYERS];

//Under OnPlayerConnect
PlayerIsJailed[playerid] = 0;

CMD:jail(playerid, params[])
{
    if(/*Playeradminvariable*/ == /*level of admin*/)
    {
        new targetid, time;
        if(sscanf(params, "id", targetid, time)) return SendClientMessage(playerid, -1, "Usage: /jail <playerid> <time>");
        if(IsPlayerConnected(targetid))
        {
            //Should add a variable here that sets the ammount of time *global variable* that checks when the player logs inm if they are jailed
            SetPlayerPos(targetid, /*posx*/, /*posy*/, /*posz*/);
            SetTimer("PlayerJailed", time /*inmiliseconds*/, false);
            PlayerIsJailed[playerid] = 1;
         }
    }
    else return SendClientMessage(playerid, -1, "You are not authorized to use this command!");
    return 1;
}

//Somewhere else
public PlayerJailed()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerIsJailed[i] == 1)
        {
            SetPlayerPos(i, /*posx*/, /*posy*/, /*posz*/);
            PlayerIsJailed[i] = 0;
        }
    }
}
If you see this, it should be pretty self-explanatory as long as you actually know the basics.

Hint: Next time, actually try something before making a thread.

PS: Some stuff may not be needed, for example, the if(PlayerIsJailed[i] == 1) as I do not see why this would be needed, but I added it anyways.

EDIT: I see, wasn't paying much attention. Thanks below.
How could i send a message to the jailed: You have been jailed for %i seconfs by administrator %s.

And to the admin: Youu have jailed %s for %i seconds.
Reply


Messages In This Thread
time %i - by Gooday - 16.04.2012, 20:04
Re: time %i - by Kindred - 16.04.2012, 20:26
Re: time %i - by aRoach - 16.04.2012, 21:06
Re: time %i - by Jonny5 - 16.04.2012, 21:12
Re: time %i - by Gooday - 17.04.2012, 13:31

Forum Jump:


Users browsing this thread: 1 Guest(s)