SA-MP Forums Archive
I need help with gate... - 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: I need help with gate... (/showthread.php?tid=507823)



I need help with gate... - Lirbo - 19.04.2014

I want to do when player press H near the object it's will open it.... and if it's open it's will close it...
someone can give me example with explain please?


Re: I need help with gate... - Parallex - 19.04.2014

Read this, it might help you.


AW: I need help with gate... - BiosMarcel - 19.04.2014

And i you don't want to read try this :P
PHP код:
#define GATE_KEY KEY_CTRL_BACK
//in onPlayerKeyStateChange
if (newkeys GATE_KEY)
{
    if(
IsPlayerInRangeOfPoint(playerid,Range,X,Y,Z);
    {
        
MoveObject(Object(The Gate),X,Y,Z,Closing Speed);
    }




Re: AW: I need help with gate... - Parallex - 19.04.2014

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
And i you don't want to read try this :P
PHP код:
#define GATE_KEY KEY_CTRL_BACK
//in onPlayerKeyStateChange
if (newkeys GATE_KEY)
{
    if(
IsPlayerInRangeOfPoint(playerid,Range,X,Y,Z);
    {
        
MoveObject(Object(The Gate),X,Y,Z,Closing Speed);
    }

Under OnGameModeInIt, you also need to create an object, like this: "The Gate: CreateObject(blah, blah);"


AW: I need help with gate... - BiosMarcel - 19.04.2014

sry forgot it


Re: AW: I need help with gate... - Lirbo - 19.04.2014

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
And i you don't want to read try this :P
PHP код:
#define GATE_KEY KEY_CTRL_BACK
//in onPlayerKeyStateChange
if (newkeys GATE_KEY)
{
    if(
IsPlayerInRangeOfPoint(playerid,Range,X,Y,Z);
    {
        
MoveObject(Object(The Gate),X,Y,Z,Closing Speed);
    }

Okay and Why It's doing a warning for me here:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & GATE_KEY)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, 1589.6, -1638.3, 14.26))
    {
        if(LSPDGG = CreateObject(3037, 1589.6, -1638.3, 14.26, 0, 0, 90)){
        MoveObject(LSPDGG,1589.6, -1638.3, 10,2);}else{
        MoveObject(LSPDGG,1589.6, -1638.3, 14.26,2);}
    }
}
    return 1;
}
Line of warning:
PHP код:
if(LSPDGG CreateObject(30371589.6, -1638.314.260090)){ 



Re: I need help with gate... - Parallex - 19.04.2014

Lirbo, you need to add "LSPPDGG = CreateObject(3037, 1589.6, -1638.3, 14.26, 0, 0, 90);" Under your OnGameModeInIt, not under the place of OnPlayerKeyStateChange.


Re: I need help with gate... - Lirbo - 19.04.2014

Quote:
Originally Posted by BenJackster
Посмотреть сообщение
Lirbo, you need to add "LSPPDGG = CreateObject(3037, 1589.6, -1638.3, 14.26, 0, 0, 90);" Under your OnGameModeInIt, not under the place of OnPlayerKeyStateChange.
I know... i did it... but i want to close the gate....
how can i do it?


Re: I need help with gate... - Astralis - 19.04.2014

MoveObject to the "closed" gate position. If player is not in the IsPlayerInRangeOfPoint.


Re: I need help with gate... - Lirbo - 19.04.2014

Quote:
Originally Posted by Neonman
Посмотреть сообщение
MoveObject to the "closed" gate position. If player is not in the IsPlayerInRangeOfPoint.
but i want to do it only when he pressing H agian