Vehicle park - 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: Vehicle park (
/showthread.php?tid=595651)
Vehicle park -
yvoms - 06.12.2015
Hello guys, i've been working on something cool for a while now.
I've created a vehicle system that stores the vehicles in a mysql database, and spawns them if a player gets in range, destroys them when a player is not.
anyways,
I'm struggeling with the command to park a vehicle.
If your not in a vehicle it should send a message saying you have to be in a vehicle.
But its saying [Server] You have succesfully parked Vehicle ID: 0 Instead of the other message.
So i was wondering if anyone could help me out with that.
the current code i have is
Код:
case 3:
{
if(!IsNull(string)) return SEM(playerid,"{ff387a}[Admin]:{ffffff} /vehicle park - You must be in the Vehicle");
new vehicleid = GetPlayerVehicleID(playerid), currvehicleid = GetPlayerVehicleID(playerid);
if(Iter_Contains(Vehicles,vehicleid))
{
GetVehiclePos(currvehicleid, ServerVehicle[vehicleid][Spawn][0], ServerVehicle[vehicleid][Spawn][1], ServerVehicle[vehicleid][Spawn][2]);
GetVehicleZAngle(currvehicleid, ServerVehicle[vehicleid][Spawn][3]);
format(string,sizeof(string),"{ff387a}[Admin]:{ffffff} Vehicle with {ffff00}id %d {ffffff}has been parked!",vehicleid);
SendClientMessage(playerid,COLOR_WHITE,string);
orm_update(ServerVehicle[vehicleid][ORM_ID]);
}
else SEM(playerid,"{ff0000}[Error]:{ffffff} Invalid vehicle!");
}
Re: Vehicle park -
yvoms - 06.12.2015
Fixed it, sorry for the topic..
Код:
case 3:
{
if(!IsNull(string)) return SEM(playerid,"{ff387a}[Admin]:{ffffff} /vehicle park [You must be driving the Vehicle]");
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid ==0) return SEM(playerid,"{ff387a}[Admin]:{ffffff} /vehicle park [You must be driving the Vehicle]");
if(Iter_Contains(Vehicles,vehicleid))
{
GetVehiclePos(vehicleid, ServerVehicle[vehicleid][Spawn][0], ServerVehicle[vehicleid][Spawn][1], ServerVehicle[vehicleid][Spawn][2]);
GetVehicleZAngle(vehicleid, ServerVehicle[vehicleid][Spawn][3]);
format(string,sizeof(string),"{ff387a}[Admin]:{ffffff} Vehicle with {ffff00}id %d {ffffff}has been parked!",vehicleid);
SendClientMessage(playerid,COLOR_WHITE,string);
orm_update(ServerVehicle[vehicleid][ORM_ID]);
}
else SEM(playerid,"{ff0000}[Error]:{ffffff} Invalid vehicle!");
}
I had to get the vehicle id and if it was vehicle id 0 it should have sent a the message again.