Jail timer, which is the best way?
#5

Quote:
Originally Posted by Tessar
Посмотреть сообщение
Post the command you made. That could be inter-fearing with the script.
I spreaded over the whole script, my script is a bit, how'd you say that..
That's why.. Anyways, here it is:

Код:
new AJailTime[MAX_PLAYERS];
forward AJailTimer();
OnGameModeInit:
Код:
SetTimer("AJailTimer", 1000, true);
OnPlayerDisconnect:
Код:
new ajailtime;
ajailtime = AJailTime[playerid];
dini_IntSet(bestand, "AJailTime", ajailtime);
OnPlayerSpawn:
if(dini_Int(bestand, "AJailed") == 1)
{
SetPlayerPos(playerid, 1388.0905,-1206.4396,202.4453);
AJailTime[playerid] = dini_Int(bestand, "AJailTime");
}

Код:
public AJailTimer()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(AJailTime[i] > 0)
            {
                AJailTime[i]--;
                if(AJailTime[i] == 0)
                {
                    new name[MAX_PLAYER_NAME], str[256];
                    GetPlayerName(i, name, sizeof(name));
					format(str, sizeof(str), "/eGamingRP/Users/%s.ini", name);
					
					dini_IntSet(str, "AJailed", 0);
                    SetPlayerPos(i, 238.6917,139.2280,1003.0234);
                    GameTextForPlayer(i, "~w~Ajail tijd ~r~verlopen", 3000, 1);
                    SendClientMessage(i, COLOR_RED,     "> Je bent uit de Admin Jail, gedraag je de volgende keer.");
                    SendClientMessage(i, COLOR_DARKRED, "> LET OP: Te erg Non-RP zijn kan leiden tot een permanente Ban.");
                }
            }
        }
    }
}
OnPlayerCommandText:
Код:
	if(strcmp("/ajail", cmd, true) == 0)
	{
	    if(dini_Int(bestand, "AdminLevel") > 0) {
			tmp = strtok(cmdtext,idx);
			if(!strlen(tmp) || strlen(tmp) > 5) {
				return SendClientMessage(playerid,COLOR_LIGHTRED,"[GEBRUIK]: /ajail [spelerid] [reden]");
			}

			new id = strval(tmp);

			if(!IsPlayerConnected(id)) {
				SendClientMessage(playerid,COLOR_RED,"** De speler die u heeft geprobeerd te 'Admin Jailen' is niet te bereiken.");
				return 1;
			}

			gMessage = strrest(cmdtext,idx);

			GetPlayerName(id,iName,sizeof(iName));
			SendClientMessage(id,COLOR_DARKRED,"[ ! ] Je bent Admin jailed voor 60 minuten.");

			if(strlen(gMessage) > 0) {
				format(Message,sizeof(Message),"Reden: %s",gMessage);
				SendClientMessage(id,COLOR_DARKRED,Message);
			}

			format(Message,sizeof(Message),"[ %s(%d) is Admin jailed. Duur: 60 minuten. Reden: %s ]",iName,id, gMessage);
			SendClientMessageToAll(COLOR_DARKRED,Message);

			SetPlayerPos(id, 1388.0905,-1206.4396,202.4453);
			AJailTime[playerid] = 3600;
			dini_IntSet(bestand, "AJailed", 1);
			return 1;
		} else {
            		    SendClientMessage(playerid, COLOR_RED, "** Deze commando kunt u (nog) niet gebruiken. [AdmCmd]");
			return 1;
		}
	}
When player registers his/herself by dialog:
Код:
dini_IntSet(bestand, "AJailTime", 0);
That was it. I know, you'll laugh at me because of the spreading and that stuff

So, this is it.. It doesnt work, who can please help me?

Thanks!

Regard,
I. C.
Reply


Messages In This Thread
Jail timer, which is the best way? - by Ihsan-Cingisiz - 30.12.2010, 14:35
Re: Jail timer, which is the best way? - by MadeMan - 30.12.2010, 14:45
Re: Jail timer, which is the best way? - by Ihsan-Cingisiz - 30.12.2010, 15:38
Re: Jail timer, which is the best way? - by Tessar - 30.12.2010, 15:49
Re: Jail timer, which is the best way? - by Ihsan-Cingisiz - 30.12.2010, 15:58
Re: Jail timer, which is the best way? - by MadeMan - 30.12.2010, 16:53

Forum Jump:


Users browsing this thread: 1 Guest(s)