I need help with gate...
#1

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?
Reply
#2

Read this, it might help you.
Reply
#3

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);
    }

Reply
#4

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);"
Reply
#5

sry forgot it
Reply
#6

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)){ 
Reply
#7

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.
Reply
#8

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?
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)