Unmovable vehicle [REP++] -
buburuzu19 - 07.12.2014
Hi guys , i made a showroom for my server with a lot of cars but my next problem is that players can move them away.
So i tried to make a timer who checks if vehicle pos coresponds with the vehicle pos from database but it's not working.
pawn Код:
public DealerCars()
{
new Float:x, Float:y, Float:z;
new vehpos = GetVehiclePos(320, x, y, z);
if(1043.8596,1586.1318,-17.1108 != vehpos)
{
SetVehicleToRespawnEx(320);
}
}
320 - vehicle id from my sql db, and the coordinates are the 320 car's coordinates.
Re: Unmovable vehicle [REP++] -
Sawalha - 07.12.2014
you can't put a callback in the script and leave it without a calling function.. it's like nothing in the script.
use a timer, callback function that is called by the timer it's self.
pawn Код:
new vtimer;
public OnGameModeInit()
{
vtimer = SetTimer("Dealercars", 100, true); // this timer for the dealercars callback, per 100 ms, and repeatable.
return 1;
}
pawn Код:
public OnGameModeExit
{
KillTimer(vtime);
return 1;
}
Re : Unmovable vehicle [REP++] -
ManuelNeuer - 07.12.2014
Create a timer which works each 1 second
Re: Unmovable vehicle [REP++] -
buburuzu19 - 07.12.2014
Quote:
Originally Posted by Sawalha
you can't put a callback in the script and leave it without a calling function.. it's like nothing in the script.
use a timer, callback function that is called by the timer it's self.
pawn Код:
new vtimer; public OnGameModeInit() { vtimer = SetTimer("Dealercars", 100, true); // this timer for the dealercars callback, per 100 ms, and repeatable. return 1; }
pawn Код:
public OnGameModeExit { KillTimer(vtime); return 1; }
|
I did what you said but not working.. still i can move cars and them are not respawning.., probably public Dealercars() is wrong?
Re: Unmovable vehicle [REP++] -
Sawalha - 07.12.2014
Oh, just forgot this:
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
if(vehicleid == 320)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(320, X, Y, Z);
if(X != new_x || Y != new_y || Z != new_z) return 0;
}
return 1;
}
Try it
Re: Unmovable vehicle [REP++] -
M4D - 07.12.2014
Your vehicles have id
In "OnPlayerStateChange" callback Make a loop between vehicle ids and check if a player entered that vehicle ids remove him from vehicle !
Re: Unmovable vehicle [REP++] -
buburuzu19 - 07.12.2014
Quote:
Originally Posted by Sawalha
Oh, just forgot this:
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) { if(vehicleid == 320) { new Float:X, Float:Y, Float:Z; GetVehiclePos(320, X, Y, Z); if(X != new_x || Y != new_y || Z != new_z) return 0; } return 1; }
Try it
|
Still not working! The car isn't respawn!
Re: Unmovable vehicle [REP++] -
buburuzu19 - 07.12.2014
I tried something like this:
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
if(vehicleid == 320)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(320, X, Y, Z);
if(X != 1043.8596 || Y != 1586.1318 || Z != -17.1108) return SetVehicleToRespawnEx(320);
}
return 1;
}
but nothing.
Re: Unmovable vehicle [REP++] -
buburuzu19 - 08.12.2014
Quote:
Originally Posted by Sawalha
Oh, just forgot this:
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) { if(vehicleid == 320) { new Float:X, Float:Y, Float:Z; GetVehiclePos(320, X, Y, Z); if(X != new_x || Y != new_y || Z != new_z) return 0; } return 1; }
Try it
|
I tried something like this:
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
if(vehicleid == 285)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(285, X, Y, Z); // tried with another vehicle
if(X != 1043.8596)
{
SetVehicleToRespawnEx(285);
}
}
}
But nothing happens , the car isn't respawning , doh ..
Any ideeas !? Thanks.
Re: Unmovable vehicle [REP++] -
buburuzu19 - 08.12.2014
Quote:
Originally Posted by Sawalha
Oh, just forgot this:
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) { if(vehicleid == 320) { new Float:X, Float:Y, Float:Z; GetVehiclePos(320, X, Y, Z); if(X != new_x || Y != new_y || Z != new_z) return 0; } return 1; }
Try it
|
Tried your method too but not working... nothing happenss