SA-MP Forums Archive
Why this doesn't 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 doesn't work? (/showthread.php?tid=378285)



Why this doesn't work? - newbienoob - 17.09.2012

pawn Код:
if(PRESSED(KEY_SECONDARY_ATTACK))
    {
        if(IsPlayerInRangeOfPoint(playerid,0.5,298.0384, -107.4380, 1001.4934))
        {
            SetPlayerCameraPos(playerid, 297.2552, -105.8125, 1003.5679);
            SetPlayerCameraLookAt(playerid, 297.6054, -106.7477, 1002.9686);
            TogglePlayerControllable(playerid,0);
            if(PRESSED(KEY_YES) && InsideAmmu[playerid] ==1 )
            {
                GivePlayerWeapon(playerid,31,500);
                SetCameraBehindPlayer(playerid);
                TogglePlayerControllable(playerid,1);
            }
            return 1;
        }
Everything works fine except this
pawn Код:
if(PRESSED(KEY_YES) && InsideAmmu[playerid] ==1 )
            {
                GivePlayerWeapon(playerid,31,500);
                SetCameraBehindPlayer(playerid);
                TogglePlayerControllable(playerid,1);
            }



Re: Why this doesn't work? - Jack_Leslie - 17.09.2012

Are you pressing KEY_SECONDARY_ATTACK and KEY_YES at the same time?


Re: Why this doesn't work? - newbienoob - 17.09.2012

No...


Re: Why this doesn't work? - Jack_Leslie - 17.09.2012

Well that's how you've coded it.... You've coded it so you need to press both at the same time if you're in range of that point and "InsideAmmu".


Re: Why this doesn't work? - newbienoob - 17.09.2012

How can I fix it? I mean, key F to choose and key y to buy.


Re: Why this doesn't work? - C00K13M0N$73R - 17.09.2012

else if(...


Re: Why this doesn't work? - clarencecuzz - 17.09.2012

This?
pawn Код:
if(PRESSED(KEY_SECONDARY_ATTACK))
{        
    if(IsPlayerInRangeOfPoint(playerid,0.5,298.0384, -107.4380, 1001.4934))        
    {            
        SetPlayerCameraPos(playerid, 297.2552, -105.8125, 1003.5679);            
        SetPlayerCameraLookAt(playerid, 297.6054, -106.7477, 1002.9686);            
        TogglePlayerControllable(playerid,0);            
    }
}
else if(PRESSED(KEY_YES) && InsideAmmu[playerid] ==1 )            
{                
    GivePlayerWeapon(playerid,31,500);                
    SetCameraBehindPlayer(playerid);                
    TogglePlayerControllable(playerid,1);            
}



Re: Why this doesn't work? - newbienoob - 17.09.2012

No. I tried to make my own ammunation like this.