AddStaticVehicle Command Error
#1

Hmm Command Works Gives me Unknown Command On CMD:VEH when i create a car dveh dont daveh dont
and another issue is it dont show me the message that an admin created a car and it dont put me in the vehicle or change the plates Anyone have any ideals good code but annoying Unknown Command and It not completing the rest of the command codes

pawn Код:
enum vInfo
{
    vCreated,
    Float:vvX,
    Float:vvY,
    Float:vvZ,
    vVehicle,
};
new VehicleInfo[MAX_VEHICLES][vInfo];
pawn Код:
//================================Create Vehicle and destroy vehicles ==========
CMD:veh(playerid, params[])
{
    if(PlayerOnline[playerid] != 0)
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 4)
        {
            new vid,c1,c2,vstring[128],vstring1[128],pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,pname,sizeof(pname));
            new Float:px,Float:py,Float:pz,Float:pa;
            if(sscanf(params,"iii",vid,c1,c2)) return SendClientMessage(playerid, ORANGE, "/veh [vehid] [color 1] [color 2]");
            if(vid<400||vid>611) return SendClientMessage(playerid, ERROR, "Vehicle Number can't be below 400 or above 611");
            if(c1<-1||c1>255 && (c2<-1||c2>255)) return SendClientMessage(playerid, ERROR, "Invalid Color 0 or 255");
            GetPlayerPos(playerid, px, py, pz);
            GetPlayerFacingAngle(playerid,pa);
            CreateVehicleS(vid,px,py,pz,pa,c1,c2);
            PutPlayerInVehicle(playerid,vid,0);
            SetVehicleNumberPlate(vid, "[ Admin ]");
            format(vstring, sizeof(vstring), "Vehicle %s(%d) spawned At %s", VehicleNames[GetVehicleModel(vid) -400],vid,GetPlayer3DZone(playerid));
            SendClientMessage(playerid, BLUE, vstring);
            format(vstring1,sizeof(vstring1), "%s(%d) Has Spawned A %s At His Position (%s).",pname,playerid,VehicleNames[GetVehicleModel(vid) -400],GetPlayer3DZone(playerid));
            AdminAnn(GREEN, vstring1);
        }
        else
        {
            SendClientMessage(playerid, ERROR, "Do What");
        }
    }
    return 1;
}

CMD:dveh(playerid, params[])
{
    if(PlayerOnline[playerid] != 0)
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 4)
        {
            DeleteClosestVehicle(playerid);
            SendClientMessage(playerid, PURPLE, "Vehicle Has Been Deleted");
        }
        else
        {
            SendClientMessage(playerid, ERROR, "Do What");
        }
    }
    return 1;
}

CMD:daveh(playerid, params[])
{
    if(PlayerOnline[playerid] != 0)
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 4)
        {
            DeleteAllVehicle();
            SendClientMessage(playerid, PURPLE, "All Vehicles Has Been Deleted");
        }
        else
        {
            SendClientMessage(playerid, ERROR, "Do What");
        }
    }
    return 1;
}
pawn Код:
//=============================Delete  Vehicle Stock==============================
stock CreateVehicleS(Vid,Float:x,Float:y,Float:z,Float:Angle,c1,c2)
{
    for(new v = 0; v < sizeof(VehicleInfo); v++)
    {
        if(VehicleInfo[v][vCreated] == 0)
        {
            VehicleInfo[v][vCreated]=1;
            VehicleInfo[v][vvX]=x;
            VehicleInfo[v][vvY]=y;
            VehicleInfo[v][vvZ]=z;
            VehicleInfo[v][vVehicle] = AddStaticVehicle(Vid, x+2, y+2, z,Angle,c1,c2);
            return 1;
        }
    }
    return 0;
}

stock DeleteAllVehicle()
{
    for(new v = 0; v < sizeof(ObjectInfo); v++)
    {
        if(VehicleInfo[v][vCreated] == 1)
        {
            VehicleInfo[v][vCreated]=0;
            VehicleInfo[v][vvX]=0.0;
            VehicleInfo[v][vvY]=0.0;
            VehicleInfo[v][vvZ]=0.0;
            DestroyVehicle(VehicleInfo[v][vVehicle]);
        }
    }
    return 0;
}

stock DeleteClosestVehicle(playerid)
{
    for(new v = 0; v < sizeof(VehicleInfo); v++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, VehicleInfo[v][vvX], VehicleInfo[v][vvY], VehicleInfo[v][vvZ]))
        {
            if(VehicleInfo[v][vCreated] == 1)
            {
                VehicleInfo[v][vCreated]=0;
                VehicleInfo[v][vvX]=0.0;
                VehicleInfo[v][vvY]=0.0;
                VehicleInfo[v][vvZ]=0.0;
                DestroyVehicle(VehicleInfo[v][vVehicle]);
                return 1;
            }
        }
    }
    return 0;
}
Reply
#2

Well, to change the plate you must create the vehicle, use the function SetVehicleNumberPlate then set the vehicle to respawn. If you do not respawn the vehicle then the plate will not change. Also it is not putting you into the vehicle because you are trying to use the model as the vehicle id, you must specify the vehicle's id.
Reply
#3

How about the messages..
Reply
#4

Not sure, it may be your 'PlayerOnline' variable and how you are using it.
Reply
#5

Probably that... But thats the only command thats doing it heh and i tried what you said is this correct way ?

new Vehicleid = CreateVehicleS(vid,px,py,pz,pa,c1,c2);
SetVehicleToRespawn(Vehicleid);
PutPlayerInVehicle(playerid,Vehicleid,0);
SetVehicleNumberPlate(Vehicleid, "[ Admin ]");

Still hasnt worked and format and message aint showing..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)