/dveh no static vehicles.
#1

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;
}
Reply
#2

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.
Reply
#3

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)