SA-MP Forums Archive
NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? (/showthread.php?tid=73932)



NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - aspire5630 - 18.04.2009

please help, i have a jail system, if your in dept at bank time, you go to jail for 3mins
how do i stop all cmds?



Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - [LCG]TANKER - 18.04.2009

you would need to add in a variable to let the script know you are in jail


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - aspire5630 - 18.04.2009

can you type me the code, im a BIG noob


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - Francis[French] - 18.04.2009

Hi there,

To make that, you must return a true value when you're in jail, like that:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(IsInJail(playerid)) // Variable here.
    return 1;

  // Your commands here

  return 0;
}
Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - aspire5630 - 18.04.2009

Quote:
Originally Posted by [SAP
Francis ]
Hi there,

To make that, you must return a true value when you're in jail, like that:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(IsInJail(playerid)) // Variable here.
    return 1;

  // Your commands here

  return 0;
}
Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com
What do i put as the variable?


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - Francis[French] - 18.04.2009

Quote:
Originally Posted by aspire5630
Quote:
Originally Posted by [SAP
Francis ]
Hi there,

To make that, you must return a true value when you're in jail, like that:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(IsInJail(playerid)) // Variable here.
    return 1;

  // Your commands here

  return 0;
}
Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com
What do i put as the variable?
Hi there,

When jailing the player, you should set a variable like "Jailed[playerid]" to true or to 1, as 1 is the numerical value of true. Then you would replace "IsInJail(playerid)" by "Jailed[playerid]".

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - aspire5630 - 18.04.2009

Quote:
Originally Posted by [SAP
Francis ]
Quote:
Originally Posted by aspire5630
Quote:
Originally Posted by [SAP
Francis ]
Hi there,

To make that, you must return a true value when you're in jail, like that:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(IsInJail(playerid)) 1
    return 1;

  // Your commands here

  return 0;
}
Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com
What do i put as the variable?
Hi there,

When jailing the player, you should set a variable like "Jailed[playerid]" to true or to 1, as 1 is the numerical value of true. Then you would replace "IsInJail(playerid)" by "Jailed[playerid]".

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com
soo i put it like that?



Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - Francis[French] - 19.04.2009

Hi there,

No, just change the "IsInJail(playerid)" by "InJail[playerid]". Then, in the /jail command, you will have to do "InJail[jailedid] = 1;".

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - NeRoSiS - 19.04.2009

This at the top

Код:
new IsJailed[MAX_PLAYERS];
Add this to your jail command, be warned, yours may not be giveplayername, it may be pname or something,.

Код:
IsJailed[giveplayerid] = 1;
Unjailll...

Код:
IsJailed[giveplayerid] = 0;
Then under oncommand etxt add this

Код:
if(IsJailed[playerid] == 1)
{
return 1;
}



Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - aspire5630 - 19.04.2009

Quote:
Originally Posted by NeRoSiS
This at the top

Код:
new IsJailed[MAX_PLAYERS];
Add this to your jail command, be warned, yours may not be giveplayername, it may be pname or something,.

Код:
IsJailed[giveplayerid] = 1;
Unjailll...

Код:
IsJailed[giveplayerid] = 0;
Then under oncommand etxt add this

Код:
if(IsJailed[playerid] == 1)
{
return 1;
}
this is the code i have

Код:
new Jailed[MAX_PLAYERS];


public OnPlayerSpawn(playerid)
{
	if(Jailed[playerid] == 1)
	{
	  SetPlayerPos(playerid, ...); // Enter your jail co ords here
	}
	return 1;
}

public Timer(playerid)
{
	SendClientMessageToAll(COLOR_YELLOW, "Please Visit us here at, Kontrol-Gaming.co.cc"); // Color can be edited, Look at top for the colors.
	SendClientMessageToAll(COLOR_YELLOW, " Please remember to report any bugs you may find, /Bug <Message>");

	for(new a=0; a<MAX_PLAYERS; a++)
  {
		if(GetPlayerMoney(a) < 0)
		{
		  SetPlayerPos(playerid, ...); // Enter you jail co ords here
		  Jailed[a] = 1;
		  SetTimerEx("UnJailTimer", 80000, 0, "d", a); // I think 80000 milliseconds is 3 mins, Correct it if its wrong
		}
		GivePlayerMoney(a, 1000);
	}
	SendClientMessageToAll(COLOR_LIGHTGREEN, "You've recieved playing money **$1000**!");
}

public UnJailTimer(playerid)
{
	Jailed[playerid] = 0;
	return 1;
}



Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - aspire5630 - 19.04.2009

Quote:
Originally Posted by NeRoSiS
This at the top

Код:
new IsJailed[MAX_PLAYERS];
Add this to your jail command, be warned, yours may not be giveplayername, it may be pname or something,.

Код:
IsJailed[giveplayerid] = 1;
Unjailll...

Код:
IsJailed[giveplayerid] = 0;
Then under oncommand etxt add this

Код:
if(IsJailed[playerid] == 1)
{
return 1;
}
can u explain where i need to put them


Re: NEED A SCRIPT WHICH WILL DISABLE ALL COMMANDS, WHEN YOUR IN JAIL? - Francis[French] - 19.04.2009

Hi there,

Please stop double-posting and use the EDIT button, which is located on the right side of all of your posts. It prevents the topic from being bumped up.

And he all explained how to make it work, you must also learn how to create basic scripts, I recommend this.

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com