SA-MP Forums Archive
how to start.. - 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: how to start.. (/showthread.php?tid=272788)



how to start.. - Rafa - 30.07.2011

i want make gate which will open on pressing "g" i dont know how to start u know how to ignore that
pawn Код:
CMD:....(playerid, params[])
{
       //code here
       return 1;
}
and what is the code for key "g"


Re: how to start.. - Beanz - 30.07.2011

Post the object locations for the gate open and closed.


Re: how to start.. - PGTips - 30.07.2011

A good place to start would be with a key bind

OnPlayerKeyStateChange

then under that try putting a radius scan so you can see how far away they are from the object if they are inrange allow them to open it check if the gate is open or closed so you can see what the player want it to do


Re: how to start.. - Rafa - 30.07.2011

i do something like this
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new PRESSED;
    if(IsPlayerInRangeOfPoint(playerid, 10, -2811.1684570313, -1524.8093261719, 142.4806060791))
    {
        if(PRESSED(KEY_FIRE))// i just see the exsample from OUL post with key_fire
        {
            MoveObject(vrata, -2811.1684570313,-1524.8093261719,142.4806060791, 2.0);
            return 1;
        }
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "use /lock 0 to unlock ur car and /lock 1 to unlock ur car");
    }
    return 1;
}
but i get this errors
pawn Код:
C:\Users\vlado\sa-mp\gamemodes\Mace-Roleplay.pwn(888) : error 012: invalid function call, not a valid address
C:\Users\vlado\sa-mp\gamemodes\Mace-Roleplay.pwn(888) : warning 215: expression has no effect
C:\Users\vlado\sa-mp\gamemodes\Mace-Roleplay.pwn(888) : error 001: expected token: ";", but found ")"
C:\Users\vlado\sa-mp\gamemodes\Mace-Roleplay.pwn(888) : error 029: invalid expression, assumed zero
C:\Users\vlado\sa-mp\gamemodes\Mace-Roleplay.pwn(888) : fatal error 107: too many error messages on one line



Re: how to start.. - PGTips - 30.07.2011

Line 888 is which one?

Also i hope thats ONLY the start of your code other wse once they press it they cant make it go back up as you havnt made that statements


Re: how to start.. - PGTips - 30.07.2011

Just realised somthing can i as why do you have a /lock 1 and 2 when you only have to copy the unlock command to the/lock command and the place a else statement?


Re: how to start.. - Rafa - 30.07.2011

ummm... i just do it like this and its working xD
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInRangeOfPoint(playerid, 10, -2811.1684570313, -1524.8093261719, 142.4806060791))
    {
        if(KEY_FIRE >= 0)// i just see the exsample from OUL post with key_fire
        {
            MoveObject(vrata, -2811.1684570313,-1524.8093261719,142.4806060791, 2.0);
            return 1;
        }
    }
    return 1;
}
but i need the code for "g" key and i need to make to back on g key the gate... xD


Re: how to start.. - PGTips - 30.07.2011

removed because what i wrote was WRONG


Re: how to start.. - Rafa - 30.07.2011

if u asking me about the ip of the server here is it: 77.29.49.210:7777


Re: how to start.. - PGTips - 30.07.2011

https://sampwiki.blast.hk/wiki/GetPlayerKeys

Hope this helps