/TIME Command
#1

/Time - Command on roleplay servers,
Im making a Cops And Robbers,
I have a /arrest command that lasts 60 seconds...
How would i make a /time command, That detects how much time is left,
And shows them?
Reply
#2

We would probably have to see your /arrest script.
Reply
#3

Why?
Its only a few send messages, A timer, And a SetPos
Reply
#4

Quote:
Originally Posted by Torran
Its only a few send messages, A timer, And a SetPos
What's the problem then?
Reply
#5

pawn Код:
dcmd_arrest(playerid, params[])
{
    if(GetPlayerTeam(playerid) == 1)
    {
        if (strlen(params))
        {
            new id = strval(params);
            if(id == playerid)
            {
            SendClientMessage(playerid, 0xFF8040FF, "You cannot arrest yourself");
            }
            else
            if (IsPlayerConnected(id))
            {
                new Float:x, Float:y, Float:z;
                GetPlayerPos(id, x, y, z);
                if(IsPlayerInRangeOfPoint(playerid, 15.0, x, y, z))
                {
                    TogglePlayerControllable(id, 1);
                    SetTimerEx("Arrest", 60000, 0, "i", id);
                    SetPlayerPos(id,264.6636,77.5167,1001.0391);
                    SetPlayerInterior(id, 6);
                    GameTextForPlayer(id, "~r~Jailed", 2000, 4);
                    //PreloadAnimLib(playerid,"CRACK");
                    //ApplyAnimation(playerid,"CRACK","crckdeth3",4.1,1,1,1,1,1);
                    //ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,1,1,1,1,1);
                    new name[MAX_PLAYER_NAME], string[128];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "Police Officer %s has arrested you for 60 seconds", name );
                    SendClientMessage(id, 0xFF8040FF, string);
                    new name1[MAX_PLAYER_NAME];
                    GetPlayerName(id, name1, sizeof(name1));
                    format(string, sizeof(string), "You have arrested %s", name1);
                    SendClientMessage(playerid, 0xFF8040FF, string);
                    }
                    else
                    {
                        SendClientMessage(playerid, 0xFF0000AA, "You're not near this player");
                    }
                    //}
                    //else
                    //{
            //SendClientMessage(playerid, 0xFF0000AA, "You cannot heal yourself");
          //}
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "Player not found");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Usage: /arrest (PlayerID/PartOfName) ");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "You need to be part of the Police Force to use this command");
    }
    return 1;
}
Reply
#6

Top of script:

pawn Код:
new JailTime[MAX_PLAYERS];
/arrest command:

pawn Код:
JailTime[id] = 60;
SetTimerEx("Arrest", 1000, 0, "i", id);
pawn Код:
public Arrest(playerid)
{
    if(JailTime[playerid] > 0)
    {
        JailTime[playerid]--;
        SetTimerEx("Arrest", 1000, 0, "i", playerid);
    }
    else
    {
        // free player from jail, SetPlayerPos and all that
    }
}
/time command

pawn Код:
dcmd_time(playerid, params[])
{
    new message[128];
    format(message, sizeof(message), "You have %d seconds left in jail", JailTime[playerid]);
    SendClientMessage(playerid, 0xFFFFFFFF, message);
    return 1;
}
Reply
#7

http://forum.sa-mp.com/index.php?topic=150771.0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)