Need scripting help with vehicle spawn command
#1

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.

PHP код:
dcmd_v(playeridparams[])
{
    if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0)
    {
        new 
idx,modelid;
        new 
tmp[256],string[256];
        
tmp strtok(paramsidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridCOLOR_ERROR"USAGE: /v (Modelid/Name)");
            return 
1;
        }
        
        
        if(
isNumeric(tmp))
        {
        
modelid strval(tmp);
        
        }else{
        
modelid GetVehicleModelIDFromNametmp );
        if( 
modelid == -)
        {
        
SendClientMessage(playeridCOLOR_ERROR"[ERROR] Invalid MODELID/NAME");
        return 
1;
        }
        }
        if(
modelid 400 || modelid 611)
        {
        
SendClientMessage(playeridCOLOR_ERROR"Enter A Vehicle Modelid Between 400 And 611");
        return 
1;
        }
        new 
Float:XFloat:YFloat:ZFloat:A;//,Interior,World;
        
GetPlayerPos(playeridXYZ);
        
GetPlayerFacingAngle(playeridA);
        
//Interior = GetPlayerInterior(playerid);
        //World = GetPlayerVirtualWorld(playerid);
        
GetXYInFrontOfPlayer(playeridXY5.0);
        
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,1000);
        
format(stringsizeof(string), "%s Spawned A (%s), Modelid: (%d)"PlayerInfo[playerid][pName], aVehicleNames[modelid 400], modelid);
}else{
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands.");
    }
    return 
1;

Thank you for you help. I really need this in my gamemode
Reply


Messages In This Thread
Need scripting help with vehicle spawn command - by DarknesS1988 - 19.09.2017, 07:21
Re: Need scripting help with vehicle spawn command - by JesterlJoker - 19.09.2017, 08:14
Re: Need scripting help with vehicle spawn command - by Sew_Sumi - 19.09.2017, 08:43
Re: Need scripting help with vehicle spawn command - by DarknesS1988 - 19.09.2017, 09:14
Re: Need scripting help with vehicle spawn command - by Sew_Sumi - 19.09.2017, 10:04

Forum Jump:


Users browsing this thread: 2 Guest(s)