/dveh no static vehicles. - 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: /dveh no static vehicles. (
/showthread.php?tid=505217)
/dveh no static vehicles. -
yvoms - 07.04.2014
Greetings,
as of the moment im trying to improve my scripting knowledge, by scripting a gamemode.
Tough i'm getting some issues, i taught maybe someone on here could help me.
So: /dveh - this command should destroy the vehicle ur in.
BUTT: i have a database with dynamic vehicles, And u should not be able to destroy vehicles that come out of the database, How will i make this happen, As of now im using this :
Код:
CMD:dveh(playerid,params[]) //Shouldn't be able to destroy vehicles that are stored in the database.
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pLevel]>=3)
{
new vehid;
if(IsPlayerInAnyVehicle(playerid))
{
vehid = GetPlayerVehicleID(playerid);
DestroyVehicle(vehid);
SendClientMessage(playerid,COLOR_WHITE,"The vehicle has been destroyed.");
}
}
else return SendClientMessage(playerid,COLOR_WHITE,"You do not have the appropiate administration level.");
return 1;
}
Re: /dveh no static vehicles. -
Vince - 07.04.2014
You should keep track of the first and last vehicle that gets loaded. Everything in between can then be flagged as static. Provided of course that none of the static vehicles get removed by other means. I believe vehicleids are reused.
Re: /dveh no static vehicles. -
yvoms - 07.04.2014
When adding a vehicle into the database, i use the following string,
Код:
format(dquery,sizeof(dquery),"INSERT INTO dvehicles (`ID`,Model,X,Y,Z,Angle,Color1,Color2,Location) VALUES (%d,%d,%f,%f,%f,%f,%d,%d,'%s')",
Can't i like, check if the vehicle has an ID and if it exist's in the database and return with an error?