Automatic gate problem
#1

My script:
Код:
new Gate;
new GateOpen =0;
Код:
forward GatesOpen();
forward GatesClose();
Код:
SetTimer("GatesOpen",1000,1);
 	Gate = CreateObject(3578, 1810.63013, 813.19897, 10.39397,   0.00000, 0.00000, 359.99155);
Код:
public GatesOpen()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
     	  if(PlayerToPoint(10.0, i, 1810.8959,806.5244,10.9965,3.8343) && GateOpen == 0) 
        {
            {
                MoveObject(Gate, 3578, 1810.63013, 813.19897, 9.07167, 5);
                GateOpen =1;
                SetTimer("GatesClose",7000,0);
        }
        }
    }
}

public GatesClose()
{
     MoveObject(Gate,3578, 1810.63013, 813.19897, 10.39397, 5); 
     GateOpen =0;
}
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
    new Float:oldpos[3], Float:temppos[3];
    GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
    temppos[0] = (oldpos[0] -X);
    temppos[1] = (oldpos[1] -Y);
    temppos[2] = (oldpos[2] -Z);
    if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
    {
        return true;
    }
    return false;
}
The error:
Код:
D:\WORLD ATTACK\gamemodes\Test.pwn(762) : warning 217: loose indentation
D:\WORLD ATTACK\gamemodes\Test.pwn(783) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#2

pawn Код:
#include <a_samp>
new Gate;
new GateOpen =0;
forward GatesOpen();
forward GatesClose();

main( ){ }

public OnGameModeInit()
{
    SetTimer("GatesOpen",1000,1);
    Gate = CreateObject(3578, 1810.63013, 813.19897, 10.39397,   0.00000, 0.00000, 359.99155);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}
public GatesOpen()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(PlayerToPoint(10.0, i, 1810.8959,806.5244,10.9965) && GateOpen == 0)
        {
            {
                MoveObject(Gate, 3578, 1810.63013, 813.19897, 9.07167, 5);
                GateOpen =1;
                SetTimer("GatesClose",7000,0);
        }
        }
    }
}

public GatesClose()
{
     MoveObject(Gate,3578, 1810.63013, 813.19897, 10.39397, 5);
     GateOpen =0;
}

PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
    new Float:oldpos[3], Float:temppos[3];
    GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
    temppos[0] = (oldpos[0] -X);
    temppos[1] = (oldpos[1] -Y);
    temppos[2] = (oldpos[2] -Z);
    if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
    {
        return true;
    }
    return false;
}
Reply
#3

I put you'r script at new pawno and this error:

Код:
D:\WORLD ATTACK\filterscripts\gate.pwn(24) : warning 213: tag mismatch
D:\WORLD ATTACK\filterscripts\gate.pwn(25) : error 001: expected token: ")", but found "{"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

i compile great D:

Quote:

Current directory: C:\Users\S0n1C\Desktop
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

================ READY ================

Reply
#5

It works but like this: LOL


Plz make it fully...

The createobject:
CreateObject(3578, 1810.63013, 813.19897, 10.39397, 0.00000, 0.00000, 359.99155);

I want to up and down... if down the player will get -20 money.. like toll.

The createobject should me stand where i parked my car.
Reply
#6

u Mean when close decrease player money ??
Reply
#7

No i mean after open the object GivePlayerMoney(playerid,-20);
SendClientMessage(playerid,COLOR_WHITE,"Welcome to LV,Thanks to paid the toll");
Reply
#8

pawn Код:
#include <a_samp>

#define COLOR_WHITE     0xFFFFFFAA
new Gate;
new GateOpen =0;
forward GatesOpen();
forward GatesClose();

main( ){ }

public OnGameModeInit()
{
    SetTimer("GatesOpen",1000,1);
    Gate = CreateObject(3578, 1810.63013, 813.19897, 10.39397,   0.00000, 0.00000, 359.99155);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}
public GatesOpen()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(PlayerToPoint(10.0, i, 1810.8959,806.5244,10.9965) && GateOpen == 0)
        {
            {
                MoveObject(Gate, 3578, 1810.63013, 813.19897, 9.07167, 5);
                GivePlayerMoney(i, -20);
                SendClientMessage(i,COLOR_WHITE,"Welcome to LV,Thanks to paid the toll");
                GateOpen =1;
                SetTimer("GatesClose",7000,0);
        }
        }
    }
}

public GatesClose()
{
     MoveObject(Gate,3578, 1810.63013, 813.19897, 10.39397, 5);
     GateOpen =0;
}

PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
    new Float:oldpos[3], Float:temppos[3];
    GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
    temppos[0] = (oldpos[0] -X);
    temppos[1] = (oldpos[1] -Y);
    temppos[2] = (oldpos[2] -Z);
    if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
    {
        return true;
    }
    return false;
}
Reply
#9

Really bad way to do this, use dynamic areas instead.
Reply
#10

Well,Its no error but gate is not close after few sec and its go to the sky after open...
The gate open object:

CreateObject(3578, 1810.63013, 813.19897, 8.96566, 0.00000, 0.00000, 359.99155);


Closed object:

CreateObject(3578, 1810.63013, 813.19897, 10.68779, 0.00000, 0.00000, 359.99155);


Also i getting the message everytime how long i stay on the place...and photo:

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)