How to make a jail command
#1

would it be

Код:



 if (strcmp("/Jail", cmdtext, true, 10) == 0)
        {
IsPlayerAdmin(playerid); // Not botherd atm, if player is or is not admin ;P
SetPlayerPos(playerid, CO-ORDS
        return 1;

then make a timer for the injail?
Reply
#2

I really don't get why people use strcmp like that, just do:
if (!strcmp("/Jail", cmdtext, true))

And yes it works like that, with strtok for playerid AND time.
but you also need a global variable:
new IsJailed[MAX_PLAYERS];

so if you want to block certain things you do:
if(IsJailed[playerid]) return SendClientMessage(playerid,COLOR_RED,"You cannot blablabla when in jail.");

and when you jail the player:
IsJailed[playerid = 1;
when you unjail same thing with 0
Reply
#3

pawn Код:
("/Jail", cmdtext, true, 10)
"/jail" is five not ten characters.
Reply
#4

Quote:
Originally Posted by OmeRinG
I really don't get why people use strcmp like that, just do:
if (!strcmp("/Jail", cmdtext, true))

And yes it works like that, with strtok for playerid AND time.
but you also need a global variable:
new IsJailed[MAX_PLAYERS];

so if you want to block certain things you do:
if(IsJailed[playerid]) return SendClientMessage(playerid,COLOR_RED,"You cannot blablabla when in jail.");

and when you jail the player:
IsJailed[playerid = 1;
when you unjail same thing with 0

Ok it works Thanks
But how do i make it soo.
i can jail a person like this

/jail [id]
Reply
#5

Anyone know?
Sorry for double post
Reply
#6

Quote:
Originally Posted by OmeRinG
I really don't get why people use strcmp like that, just do:
if (!strcmp("/Jail", cmdtext, true))
Because it's the default in new.pwn =(
Reply
#7

Quote:
Originally Posted by aspire5630
Anyone know?
Sorry for double post
I think there are enough (hundred of) examples on this forum..
Reply
#8

Quote:
Originally Posted by 0rb
Quote:
Originally Posted by aspire5630
Anyone know?
Sorry for double post
I think there are enough (hundred of) examples on this forum..
Yes i have looked but they all seem to be from the GF
and i dont want from GF because i have tryed and it doesent work, i get errors
Reply
#9

Once again, sorry for double post
but i need a script badly, anyone help?
Reply
#10

** Bump, i have tryed GF
and i couldt get it to work, to many errors :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)