CUff Key

Started by [VSS]Shawn, Jul 03, 2015, 08:30 PM

Previous topic - Next topic

[VSS]Shawn

Hello friends i am facing one problem i have this bind key of cuff when ever y press left shift it say u must be near to a wanted player but when i goto near wanted level it still say you need to be near wanted level player

Solution?


if ( key == LShift )
{
if(GetJob(player)==2)
                {
                    local b = 0,plr;
                    foreach(a,val in players)
                    {
                        plr= FindPlayer( players[a].tointeger() );
                        if(plr)
                        {   
                        if ( binfo[plr.ID].logged==true )
                        {
                            if(GetPlayerDistance(player,plr) <= 3)
                            {
                                if(GetWantedLevel(plr)>0)
                                {
                                   
                                    if(pinfo[plr.ID].taze.tointeger() ==1){ b++; ClientMessage ( "> "+plr.Name+" is already cuffed.",player,255,255,0); }
                                        else if (pinfo[plr.ID].robbing ==1) ClientMessage ( "Error - You cannot cuff a player while he/she is robbing a store.", player,255,255,0);
                                        else if(pinfo[plr.ID].jailed==1) ClientMessage ( "> "+plr.Name+" is in jail.",player,255,255,0);
                                        else if(plr.Vehicle) ClientMessage ( "> "+plr.Name+" is in a vehicle.",player,255,255,0);
                                        else if(pinfo[plr.ID].breakcuff==1) ClientMessage ( "> "+plr.Name+" just broke the cuffs, you cannot cuff him upto 10 seconds after he broke the cuffs.",player,255,255,0);

                                        else
                                        {
                                            ClientMessage ( "Cuffed [ "+plr.Name+" ], now you can use / arrest to send him/her to the jail.",player,255,255,0);
                                            ClientMessage ( "Officer "+player.Name+" has cuffed you. ",plr,255,255,0);
                                            pinfo[plr.ID].taze=1;
                                            plr.IsFrozen = true;
                                            d <- NewTimer( "cuffanim", 100, 230, plr.ID);
                                            c <- NewTimer( "anticuffabuse", 30000 , 1, plr.ID);
                                            print (c);
                                            cuffff.push(plr.ID);
                                            cufffff.push(c);
                                            animcufff.push(d);
                                        }
                                }
                            }
                        }
                        }
                       
                    }
                    if(b==0) ClientMessage ( "You need to be near to a wanted player to cuff him/her.",player,255,255,0);
                }
}

Stormeus

You never set b = 1

[VSS]Shawn

i have to add that after
else
{
b = 1;?

but i am use that cmd but that works fine

Stormeus

Yes, you do need to do that. I sincerely think you might benefit from a review of computational logic, though:
https://www.khanacademy.org/computing/computer-programming/programming/logic-if-statements/a/review-logic-and-if-statements