Help /prison
#1

i have this

Код:
	if(strcmp(cmd, "/prison",true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] < 1338)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Ne ste ovlasteni za taa komanda !");
	            return 1;
	        }
	        tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /prison [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
		    if(IsPlayerConnected(giveplayerid))
		    {
		        if(giveplayerid != INVALID_PLAYER_ID)
		        {
		            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* Go zatvorivte %s vo Popraven dom.", giveplayer);
					SendClientMessage(playerid, COLOR_LIGHTRED, string);
					format(string, sizeof(string), "* Zatvoreni ste vo popraven dom od admin %s.", sendername);
					SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
					GameTextForPlayer(giveplayerid, "~w~Dobrodojdovte vo ~n~~r~Popraven dom", 5000, 3);
					WantedPoints[giveplayerid] = 0;
					WantedLevel[giveplayerid] = 0;
					PlayerInfo[giveplayerid][pJailed] = 2;
					PlayerInfo[giveplayerid][pJailTime] = 1000;
		            SetPlayerPos(giveplayerid, 122.69999695,1906.69995117,-53.09999847);
		            SetPlayerPos(giveplayerid, 122.40000153,1928.90002441,-53.09999847);
					SetPlayerWorldBounds(giveplayerid, 337.5694,101.5826,1940.9759,1798.7453); //285.3481,96.9720,1940.9755,1799.0811
		        }
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   Toj igrac e isklucen !");
			    return 1;
			}
	    }
	    return 1;
	}
How can i make it so when i put someone in prison that i decide how much because that line
Quote:

PlayerInfo[giveplayerid][pJailTime] = 1000;

Makes up the time i want for me to decide how much the person will be in the prison
Reply
#2

so noone know how can i make this?
Reply
#3

You can separate the string into tokens or use another string function available here in the forums to actually let you input: /prison playerid 500, /prison playerid 100, etc...

Or use /prison command to show a Dialog that expects a user input, then use that imput text to set the time the player will be in jail.

Like:

Код:
if( !strcmp(cmd, "/prison", true) )
{
     ShowPlayerDialog(playerid,XXX,DIALOG_STYLE_INPUT,"Jail time","How much time will the player remain in prison?:","Accept","Cancel");

      return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == XXXX)
    {
        if(response) 
        {
              PlayerInfo[giveplayerid][pJailTime] = strval(inputtext);
        }
    }
This code is an EXAMPLE. Use it to create/change your script to do what you need.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)