SA-MP Forums Archive
Move problem help - 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: Move problem help (/showthread.php?tid=341453)



Move problem help - [LHT]Bally - 10.05.2012

how do i make it so the object moves when player is in point

pawn Код:
CreateDynamicObject(18450, 1653.9000244141, -3886.1000976563, -5.9000000953674, 0, 0, 339.2138671875);//Closed
CreateDynamicObject(18450, 1653.9000244141, -3886.1000976563, 9, 0, 0, 339.2138671875);//Open
i want it so it works off both Sides of player inpoint

pawn Код:
AddPlayerClass(201,1612.9235,-3870.7036,10.3205,249.1435,0,0,0,0,0,0); // LS pORT SIDE // 1ST SIDE TO WORK OFF
AddPlayerClass(201,1696.7499,-3902.6533,10.3205,73.0088,0,0,0,0,0,0); // islamabad side// OTHER SIDE

pawn Код:
#include <a_samp>
#include <streamer>
#include <foreach>
#define red 0xFF0000AA
#define Message_color 0xFF0000AA
new bus;
forward Tolls(playerid);
forward Close();
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("bus barriier");
    print("--------------------------------------\n");
    bus = CreateDynamicObject(18450, 1653.9000244141, -3886.1000976563, -5.9000000953674, 0, 0, 339.2138671875);
//-------------------------------------Objects--------------------------------------------------//
   
//------------------------------------------------------------------------------------------------//
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect( playerid )
{
SetTimerEx("Tolls", 1500, true, "d", playerid);
return 1;
}
public Tolls(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1653.9000244141, -3886.1000976563, -5.9000000953674))
    {
       
           MoveDynamicObject(bus, 1653.9000244141, -3886.1000976563, 9, 2.5);
            SetTimerEx("Close",7000,false,"i", 0);
            }


        }


public Close()
{
    MoveDynamicObject(bus, 1653.9000244141, -3886.1000976563, -5.9000000953674, 3.5);
    return 1;
}



Re: Move problem help - ViniBorn - 10.05.2012

I didn't understand the problem.
Is there any image to better explain?


Re: Move problem help - [LHT]Bally - 10.05.2012

well basically the object dont move at all, so was wondering if anyone could correct it and make it so the iobject moves off both of them addplayerclass x,y,z places


Re: Move problem help - [LHT]Bally - 10.05.2012

anyone know what can be wrong ?


Re: Move problem help - [LHT]Bally - 10.05.2012

Ive got it to move once then if i do /rcon reloadfs it wont work for some reason , and once i have it moving it spams constant how to stop this.

Also the object doesnt go to the coordinates i made.
Screenshots




Re: Move problem help - CrazyGab - 10.05.2012

I assume that the SendClientMessage is inside the following code:


pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1653.9000244141, -3886.1000976563, -5.9000000953674))
    {
       
           MoveDynamicObject(bus, 1653.9000244141, -3886.1000976563, 9, 2.5);
            SetTimerEx("Close",7000,false,"i", 0);
            }


        }
And that gets called every 1.5 seconds which means it will spam the message every 1.5 seconds aswell.

However there is an easy fix for this. you could simply do like this:

pawn Код:
new bool:block;
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1653.9000244141, -3886.1000976563, -5.9000000953674) && block == false)
    {
           
           block = true;
           MoveDynamicObject(bus, 1653.9000244141, -3886.1000976563, 9, 2.5);
            SetTimerEx("Close",7000,false,"i", 0);
            }


        }
This would pretty much make a block that would hinder spam. It simply allows it to call the function once before it blocks it.

And then you add another IsPlayerInRage of point on the other side of the bridge which would set the block to false if you require it to detect you once more.

I hope I helped.


Re: Move problem help - [LHT]Bally - 11.05.2012

It stopped the spam , but stil doesnt sort out the moving problem