Problem Whit NCP and ID vehicle
#1

Hello , I have an NCP Bot inside a vehicle that makes a journey , how do I set the id of the vehicle to 100 because I cause problems when creating vehicles to the dealer
Reply
#2

Vehicle IDs are automatically assigned upon creation, you can't change them. You can make your own IDs but it's stupid and waste of memory. You should change your dealer system so it doesn't depend on vehicle id range. Show us dealer code and we might be able to help you.
Reply
#3

CreateVehicle

Quote:

CMD:creaveicolo(playerid, params[])
{
/*TIPO VEICOLO
1 VENDITA
2 FAZIONE LEGALE
3 AFFITTO
4 PROPRIETA
*/
new Float,Float:y,Float:z,Float:a;
new modello,prezzo, colore1,colore2,id;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
if(sscanf(params,"iiii",modello,prezzo,colore1,col ore2)) return SCM(playerid, COMANDO_USARE, "USARE: /creaveicolo <modello> <prezzo> <colore 1> <colore 2>");
if(modello < 400 || modello > 603) return SCM(playerid, COMANDO_USARE, "ATTENZIONE: Inserisci un modello tra 400 e 603");
if(colore1 < 0 || colore1 > 186) return SCM(playerid, COMANDO_USARE, "ATTENZIONE: Inserisci un colore tra 0 e 186");
if(colore2 < 0 || colore2 > 186) return SCM(playerid, COMANDO_USARE, "ATTENZIONE: Inserisci un colore tra 0 e 186");
if(prezzo < 1) return SCM(playerid, COMANDO_USARE, "ATTENZIONE: Non puoi inserire un prezzo inferiore a 1$");
for(new v = 1;v < sizeof(VeicoloInfo);v++)//Loops through all the businesses
{
if(VeicoloInfo[v][vTipo] == 0)//Checks if the price of a business is 0.
{
id = v;
break;//It stops looping if it is.
}
}
CreateVehicle(modello,x,y,z,a,0,0,-1);
VeicoloInfo[id][vModello] = modello;
VeicoloInfo[id][vPrezzo] = prezzo;
VeicoloInfo[id][vTipo] = 1;
VeicoloInfo[id][vSpawnX] = x;
VeicoloInfo[id][vSpawnY] = z;
VeicoloInfo[id][vSpawnZ] = y;
VeicoloInfo[id][vSpawnA] = a;
VeicoloInfo[id][vArma1] = 0;
VeicoloInfo[id][vMunizioni1] = 0;
VeicoloInfo[id][vArma2] = 0;
VeicoloInfo[id][vMunizioni2] = 0;
VeicoloInfo[id][vVita] = 1000;
VeicoloInfo[id][vBenzina] = 100;
VeicoloInfo[id][vColore1] = colore1;
VeicoloInfo[id][vColore2] = colore2;
SetVehicleHealth(id, VeicoloInfo[id][vVita]);
Salvaveh(id);
return 1;
}
LoadVehicle in OnGameModeInIt

Quote:

for(new idx5 = 1; idx5 < sizeof(VeicoloInfo); idx5++)//Creates a loop, that goes through all of the businesses.
{
//Veicoli
format(str5, sizeof(str5), VPATH, idx5);
INI_ParseFile(str5, "LoadVeh_%s", .bExtra = true, .extra = idx5);
CreateVehicle(VeicoloInfo[idx5][vModello], VeicoloInfo[idx5][vSpawnX],VeicoloInfo[idx5][vSpawnY],VeicoloInfo[idx5][vSpawnZ], VeicoloInfo[idx5][vSpawnA],-1, VeicoloInfo[idx5][vColore2],VeicoloInfo[idx5][vColore2]);
SetVehicleHealth(idx5, VeicoloInfo[idx5][vVita]);
}
Reply
#4

Why is vehicle ID 100 important to your NPC? I don't see anything in code you posted that has any relation to ID 100.
Reply
#5

if I add bots to my server, when I go into a vehicle for sale to see the price I do not see why it does go to the ID conflicts while I get it off everything works, how come?

PHP код:

if(newstate == PLAYER_STATE_DRIVER)
    {
        new 
str[128];
           if(
VeicoloInfo[GetPlayerVehicleID(playerid)][vTipo] == 1)
        {
            
format(str,sizeof(str),"Veicolo in vendita, prezzo: %d$, digita /compra per acquistarlo"VeicoloInfo[GetPlayerVehicleID(playerid)][vPrezzo]);
            
SCM(playeridGRIGIOstr);
            return 
1;
        }

Reply
#6

And if I make the creaveicolo Starting from putting the bot with the id 1 ?
Reply


Forum Jump:


Users browsing this thread: