SA-MP Forums Archive
Key_Submission - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Key_Submission (/showthread.php?tid=259980)



Key_Submission - bernardo - 06.06.2011

Hello,

I have this code in KEY_SUBMISSION but i press the key and dont work.
pawn Код:
else if(PRESSED(KEY_SUBMISSION))
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            new vid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(lights != 1)
            {
                SetVehicleParamsEx(vid,engine,1,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid, COLOR_WHITE, "Ligas-te as Luzes!");
            }
            else
            {
                SetVehicleParamsEx(vid,engine,0,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid, COLOR_WHITE, "Desligas-te as Luzes!");
            }
            return 1;
        }
    }
Can you help me?


Re: Key_Submission - Vince - 06.06.2011

You're pressing the right key? Also, learn how to debug (god, I should write a tutorial about that). Add prints and see what's being called and what not.


Re: Key_Submission - bernardo - 06.06.2011

That Code above dont work.

But now this code, works if i press 2(Numpad) and +(Numpad).
pawn Код:
else if(newkeys == KEY_SUBMISSION)
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            new vid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(lights != 1)
            {
                SetVehicleParamsEx(vid,engine,1,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid, COLOR_WHITE, "Ligas-te as Luzes!");
            }
            else
            {
                SetVehicleParamsEx(vid,engine,0,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid, COLOR_WHITE, "Desligas-te as Luzes!");
            }
        }
    }