[HELP] Command
#1

So, i have a jail command for cops , but it doesn't work ... :/
When I type /copjail [ID] it says unknown command , and when i type /copjail says the way how to use.

Help ?

Code:

Код:
if(strcmp(cmdtext, "/copjail", true) == 0)
{
	tmp = strtok(cmdtext, idx);
 	if(!strlen(tmp))
	{
 		SendClientMessage(playerid, COLOR_GREEN, "Use: /copjail [Player ID]");
  		return 1;
   }
	giveplayerid = strval(tmp);
	if(jailed[giveplayerid]==0)
	{
    if (gTeam[playerid] == COPS)
		{
      if (IsPlayerConnected(giveplayerid))
			{
				GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "You have been jailed by officer %s!", sendername, playerid);
   			SendClientMessage(giveplayerid, COLOR_RED1, string);
    		format(string, sizeof(string), "%s has been jailed by %s!", giveplayer, giveplayerid, sendername, playerid);
   			SendClientMessageToAll(COLOR_RED1, string);
        printf(string);
        SetPlayerInterior(giveplayerid,3);
				jailed[giveplayerid] = 1;
 				SetPlayerPos(giveplayerid,198.3797,160.8905,1003.0300);
 				SetPlayerFacingAngle(giveplayerid,177.0350);
 				SetCameraBehindPlayer(giveplayerid);
  				PlayerPlaySound(giveplayerid,1082,198.3797,160.8905,1003.0300);
  				TogglePlayerControllable(giveplayerid,0);  //So the player that is jailed can't use /kill
  			DisablePlayerCheckpoint(giveplayerid);
        SetTimerEx("UnJail",180000,true,"d",playerid);
   			return 1;
    	}else{
    		format(string, sizeof(string), "ID %d is not connected.", giveplayerid);
				SendClientMessage(playerid, COLOR_YELLOW, string);
			}
			}else{
    		format(string, sizeof(string), "You are not a cop", giveplayerid);
    		SendClientMessage(playerid, COLOR_YELLOW, string);
			}
			}else{
				format(string, sizeof(string), "He/She is already jailed", giveplayerid);
				SendClientMessage(playerid, COLOR_YELLOW, string);
			}
		}
	return 0;
}
Unjail:

Код:
public UnJail(playerid)
{
	if(jailed[playerid] == 1)
	{
	  SetPlayerPos(playerid,197.1827,179.1550,1003.0234);
	  jailed[playerid] == 0;
	  SendClientMessage(playerid, COLOR_RED,"SERVER: You've been unjailed .");
	}
}
Unjail Warning:

Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\LVCNR.pwn(530) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Warnings.
Код:
Line 530:	  jailed[playerid] == 0;
Reply
#2

This jailed[playerid] == 0; should be jailed[playerid] = 0;

And put return 1; on the end of the command.
Reply
#3

Okay, fixed warning, but the command still doesn't working

it says unknown command , i am testing with my self , is it a problem ? cuz it don't have a jail-yourself protection :/
Reply
#4

I NEED TO DOUBLE-POST TO YOU HELP ME ?
Reply
#5

Try:
http://pawn.pastebin.com/d267b860
Reply
#6

I tryed , still the same .
Reply
#7

note the formats..
Reply
#8

What you wanna mean ? i am newbie , speak with easy words ...
Reply
#9

pawn Код:
format(string, sizeof(string), "You are not a cop", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
is wrong
Search on wiki how to use formats and SCM.
Reply
#10

If I change it my command will work? can U post the code ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)