Veh command problem
#1

Hello,
Recently I have started adding factions on my server. Now this is going all fine, Im making steady progress, but one thing is really not making any sense to me.
PHP код:
CMD:veh(playeridparams[]) {
    new 
vehidcolor1color2;
    new 
admstring[256];
    if (
PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playeridCOLOR_LIGHTRED"Nu esti autorizat sa folosesti aceasta comanda!");
    if(
sscanf(params"iii"vehidcolor1color2)) return SendClientMessage(playeridCOLOR_LIGHTRED"Syntax: /veh <carid> <color 1> <color 2>");
    if (
vehid 400 || vehid 611) return SendClientMessage(playeridCOLOR_LIGHTRED"Invalid car id! [Car ID's range from 400 -> 611]");
    else
    {
        new 
Float:xFloat:yFloat:zFloat:ang;
        
GetPlayerPos(playeridxyz);
        
GetPlayerFacingAngle(playeridang);
        
vCar[playerid] = AddStaticVehicle(vehid3yzangcolor1color2);
        
PutPlayerInVehicle(playeridvCar[playerid], 0);
        
format(admstringsizeof(admstring), "AdmCMD: %s has spawned a %s (%d) (%d total cars)."GetName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], vehidvCar[playerid]);
    }
    
SMA(COLOR_LIGHTREDadmstring);
    return 
1;

That is my veh command, now the problem is when I spawn a vehicle the total cars shows 12, aka the 11 faction vehicles + my vehicle. All my faction vehicles are created in OnGamemodeInit using AddStaticVehicleEx...

Why are they mixing? By the way, when I use AddStaticVehicleEx I use newsv[1] = ... etc, so it shouldnt be mixing with vCar at all.
Reply
#2

i can help u i think
Reply
#3

Quote:
Originally Posted by Jithu
Посмотреть сообщение
i can help u i think
How?
Reply
#4

Could explain your problem more briefly?

PHP код:
CMD:veh(playeridparams[]) { 
    new 
Float:xFloat:yFloat:zFloat:ang;
    new 
admstring[144], vehidcolor1color2;  
    if (
PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playeridCOLOR_LIGHTRED"Nu esti autorizat sa folosesti aceasta comanda!"); 
    if(
sscanf(params"iii"vehidcolor1color2)) return SendClientMessage(playeridCOLOR_LIGHTRED"Syntax: /veh <carid> <color 1> <color 2>"); 
    if (
vehid 400 || vehid 611) return SendClientMessage(playeridCOLOR_LIGHTRED"Invalid car id! [Car ID's range from 400 -> 611]"); 
    
GetPlayerPos(playeridxyz); 
    
GetPlayerFacingAngle(playeridang); 
    
vCar[playerid] = CreateVehicle(vehid3yzangcolor1color2);
    
PutPlayerInVehicle(playeridvCar[playerid], 0); 
    
Printf("Vehicle ID: %i"vehid);
    
format(admstringsizeof(admstring), "AdmCMD: %s has spawned a %s (%d) (%d total cars)."GetName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], vehidvCar[playerid]); 
    
SMA(COLOR_LIGHTREDadmstring); 
    return 
1

I edited your command a bit try debugging it. See what vehicle ids are being outputted when you spawn a vehicle with this command.
Reply
#5

I fixed it already, the vCar var was causing issues.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)