Why this CMD dont work ?
#1

PHP код:
CMD:detain(playeridparams[])
{
    new 
playerbseatidstring[128];
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(!
IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not an BCPD Oficer/FBI Agent.");
    if(
sscanf(params"ui"playerbseatid)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /detain [playerid] [seatid]");
    if(!
IsPlayerLoggedIn(playerb)) return SendClientMessage(playeridCOLOR_GREY"Invalid player specified.");
    if(!
IsPlayerNearPlayer(playeridplayerb2)) return SendClientMessage(playeridCOLOR_GREY"You can't detain someone from this disatance.");
    if(!
IsPlayerCuffed(playerb)) return SendClientMessage(playeridCOLOR_GREY"Player is not cuffed.");
    if(
seatid || seatid 3) return SendClientMessage(playeridCOLOR_GREY"You can only detain people in seats 2 and 3.");
    
PutPlayerInVehicle(playerbLastCar[playerid], seatid);
    
format(stringsizeof(string), "* %s grabs %s from their cuffs and throws him inside the BCPD cruiser."RPN(playerid), RPN(playerb));
    
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    return 
1;

This is under onplayerexitvehicle
PHP код:
    if(PlayerInfo[playerid][pFac] == && PlayerInfo[playerid][pFac] == && PlayerInfo[playerid][pFac] == 6)
    {
        
LastCar[playerid] = vehicleid;
    } 
When a cop try it the suspect isnt thrown in the car
Reply
#2

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))
Reply
#3

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.
Reply
#4

again dont work.
Reply
#5

bump
Reply
#6

bump
Reply
#7

Stop bumping we already posted today. Whats the problem? If there is any error post it here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)