SA-MP Forums Archive
Why this CMD dont work ? - 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)
+--- Thread: Why this CMD dont work ? (/showthread.php?tid=487195)



Why this CMD dont work ? - barts - 12.01.2014

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


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.