Spawn from a specific ID
#1

How can I make this command spawn vehicles from ID 800 and above? I want it to be from ID 800 so it wont mess up with my other IDs.
pawn Код:
if(strcmp(cmd, "/veh", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] < 6)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new car;
            car = strval(tmp);
            if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new color1;
            color1 = strval(tmp);
            if(color1 < -1 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new color2;
            color2 = strval(tmp);
            if(color2 < -1 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid, X,Y,Z);

            new Float:Angle;
            GetPlayerFacingAngle(playerid, Angle);

            new carid = AddStaticVehicleEx(car, X,Y,Z, Angle, color1, color2, -1);
            createdcar[carid] = carid;
            engineOn[carid] = false;
            LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
            SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
            PutPlayerInVehicle(playerid, carid, 0);
            format(string, sizeof(string), "** Vehicle %d spawned.", carid);
            SendClientMessage(playerid, COLOR_GREY, string);
            new housename[24]; GetVehicleName(carid, housename, sizeof(housename));
            new area[36]; GetPlayer2DZone(playerid, area, sizeof(area));
            format(string,sizeof(string), "[ADMIN]: %s Has Spawned a %s (%d) [%d] At His Position (%s).",sendername,housename,car,carid,area);
            ABroadCast(COLOR_LIGHTRED, string, 5);
            new y, m, d;
            new h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Spawned a %s (%d) [%d] (Color 1: %d | Color 2: %d) At His Position.",d,m,y,h,mi,s,sendername,housename,car,carid,color1,color2);
            AdminLog(string);
        }
        return 1;
    }
Reply
#2

You cannot. Vehicle IDs start from 0 and they get increased by one. If there are in a server, let's say: IDs 0, 2, 3
If you create a vehicle, then it will get the vehicleid 1.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You cannot. Vehicle IDs start from 0 and they get increased by one. If there are in a server, let's say: IDs 0, 2, 3
If you create a vehicle, then it will get the vehicleid 1.
Recheck the wiki, vehicleids always started from 1 since sa-mp 0.1
Reply
#4

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Recheck the wiki, vehicleids always started from 1 since sa-mp 0.1
I know, that was a mistake by my side.
Reply
#5

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Recheck the wiki, vehicleids always started from 1 since sa-mp 0.1
Correct. They start from 1 and there is no way to modify the server-sided vehicle ID's unfortunately.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)