Why this CMD dont work ? -
barts - 12.01.2014
PHP код:
CMD:detain(playerid, params[])
{
new playerb, seatid, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an BCPD Oficer/FBI Agent.");
if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /detain [playerid] [seatid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
PutPlayerInVehicle(playerb, LastCar[playerid], seatid);
format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the BCPD cruiser.", RPN(playerid), RPN(playerb));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
This is under onplayerexitvehicle
PHP код:
if(PlayerInfo[playerid][pFac] == 1 && PlayerInfo[playerid][pFac] == 7 && PlayerInfo[playerid][pFac] == 6)
{
LastCar[playerid] = vehicleid;
}
When a cop try it the suspect isnt thrown in the car
Re: Why this CMD dont work ? -
Voxel - 12.01.2014
You are using "&&" which means "and" so you need to be pFac 1 AND pFac 7 AND pFac 6, if you are only in faction 1 you wont have the requirement. The correct control structure for this code would be "||" which means "or".
pawn Код:
if(PlayerInfo[playerid][pFac] == 1 || PlayerInfo[playerid][pFac] == 7 || PlayerInfo[playerid][pFac] == 6)
{
LastCar[playerid] = vehicleid;
}
I reccomend taking a look at:
https://sampwiki.blast.hk/wiki/Control_Structures
From this wiki:
Operator Meaning Usage
== Left is equal to Right if (Left == Right)
!= Left is not equal to Right if (Left != Right)
> Left is greater than Right if (Left > Right)
>= Left is greater than or equal to Right if (Left >= Right)
< Left is less than Right if (Left < Right)
<= Left is less than or equal to Right if (Left <= Right)
Operator Meaning Usage
&& and if (Left && Right)
|| or if (Left || Right)
! not if (!Variable)
nor if (!(Left || Right))
nand if (!(Left && Right))
Re: Why this CMD dont work ? -
xZdadyZx - 12.01.2014
But if you can make.amx from script maybe you use cmd wrong i think... Also you put seatid as >2 AND <3 why dont you try with >=2 and <=3 or something like that.
Re: Why this CMD dont work ? -
barts - 12.01.2014
again dont work.
Re: Why this CMD dont work ? -
barts - 12.01.2014
bump
Re: Why this CMD dont work ? -
barts - 12.01.2014
bump
Re: Why this CMD dont work ? -
xZdadyZx - 12.01.2014
Stop bumping we already posted today. Whats the problem? If there is any error post it here.