19.09.2017, 07:21
Looking for scripting help. I'm trying to script vehicle spawner by car type (LAW ENFOREMENT, ADMIN, CIVILIAN, DRIVER. I have already modified one gamemode of Cops And Robbers but i don't know how to add this to my vehicle spawner. So look here:
I have already defined car types in my gamemode:
#define VEHICLE_TYPE_LAW_ENFOREMENT 1 // if you enter this vehicle type as civilian, you get 8 wanted lvl stars
#define VEHICLE_TYPE_CIVILIAN 2 // Anyone can enter this type of vehicle
#define VEHICLE_TYPE_DRIVER 3 // This type of vehicle can be used for /driver [fare] (you can be on duty as taxi)
#define VEHICLE_TYPE_ADMIN 4 // Only Admins can use this type of vehicle. If player enter,he gets EJECTED
I Have used this for static vehicles:
// Car Spawns
/*
VEHICLE_TYPE_LAW_ENFOREMENT 1
VEHICLE_TYPE_CIVILIAN 2
VEHICLE_TYPE_DRIVER 3
VEHICLE_TYPE_ADMIN 4
CreateStaticVehicle(VEHICLE_TYPE_LAW_ENFOREMENT,mo delid,Float:X,Float:Y,Float:Z,Float:A,ColorOne,Col orTwo);
*/
But I want to make it also for spawned vehicles by an admin with command /v [model]. How can I add vehicle type to this command? I have already tried to do something but iam always getting atleast 5 errors.. By this command, you can only spawn CIVILIAN type of vehicle.
Thank you for you help. I really need this in my gamemode
I have already defined car types in my gamemode:
#define VEHICLE_TYPE_LAW_ENFOREMENT 1 // if you enter this vehicle type as civilian, you get 8 wanted lvl stars
#define VEHICLE_TYPE_CIVILIAN 2 // Anyone can enter this type of vehicle
#define VEHICLE_TYPE_DRIVER 3 // This type of vehicle can be used for /driver [fare] (you can be on duty as taxi)
#define VEHICLE_TYPE_ADMIN 4 // Only Admins can use this type of vehicle. If player enter,he gets EJECTED
I Have used this for static vehicles:
// Car Spawns
/*
VEHICLE_TYPE_LAW_ENFOREMENT 1
VEHICLE_TYPE_CIVILIAN 2
VEHICLE_TYPE_DRIVER 3
VEHICLE_TYPE_ADMIN 4
CreateStaticVehicle(VEHICLE_TYPE_LAW_ENFOREMENT,mo delid,Float:X,Float:Y,Float:Z,Float:A,ColorOne,Col orTwo);
*/
But I want to make it also for spawned vehicles by an admin with command /v [model]. How can I add vehicle type to this command? I have already tried to do something but iam always getting atleast 5 errors.. By this command, you can only spawn CIVILIAN type of vehicle.
PHP код:
dcmd_v(playerid, params[])
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0)
{
new idx,modelid;
new tmp[256],string[256];
tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /v (Modelid/Name)");
return 1;
}
if(isNumeric(tmp))
{
modelid = strval(tmp);
}else{
modelid = GetVehicleModelIDFromName( tmp );
if( modelid == -1 )
{
SendClientMessage(playerid, COLOR_ERROR, "[ERROR] Invalid MODELID/NAME");
return 1;
}
}
if(modelid < 400 || modelid > 611)
{
SendClientMessage(playerid, COLOR_ERROR, "Enter A Vehicle Modelid Between 400 And 611");
return 1;
}
new Float:X, Float:Y, Float:Z, Float:A;//,Interior,World;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
//Interior = GetPlayerInterior(playerid);
//World = GetPlayerVirtualWorld(playerid);
GetXYInFrontOfPlayer(playerid, X, Y, 5.0);
CreateVehicle(modelid, X,Y,Z + 2.0,A + 90.0,-1,-1,1000);
format(string, sizeof(string), "%s Spawned A (%s), Modelid: (%d)", PlayerInfo[playerid][pName], aVehicleNames[modelid - 400], modelid);
}else{
SendClientMessage(playerid, COLOR_ERROR, "Unknown Command! Type /cmds For Available Commands.");
}
return 1;
}