Veh command problem -
Byonic - 21.03.2018
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(playerid, params[]) {
new vehid, color1, color2;
new admstring[256];
if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu esti autorizat sa folosesti aceasta comanda!");
if(sscanf(params, "iii", vehid, color1, color2)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Syntax: /veh <carid> <color 1> <color 2>");
if (vehid < 400 || vehid > 611) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid car id! [Car ID's range from 400 -> 611]");
else
{
new Float:x, Float:y, Float:z, Float:ang;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, ang);
vCar[playerid] = AddStaticVehicle(vehid, x + 3, y, z, ang, color1, color2);
PutPlayerInVehicle(playerid, vCar[playerid], 0);
format(admstring, sizeof(admstring), "AdmCMD: %s has spawned a %s (%d) (%d total cars).", GetName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], vehid, vCar[playerid]);
}
SMA(COLOR_LIGHTRED, admstring);
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.
Re: Veh command problem -
Jithu - 21.03.2018
i can help u i think
Re: Veh command problem -
Byonic - 21.03.2018
Quote:
Originally Posted by Jithu
i can help u i think
|
How?
Re: Veh command problem -
ISmokezU - 21.03.2018
Could explain your problem more briefly?
PHP код:
CMD:veh(playerid, params[]) {
new Float:x, Float:y, Float:z, Float:ang;
new admstring[144], vehid, color1, color2;
if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu esti autorizat sa folosesti aceasta comanda!");
if(sscanf(params, "iii", vehid, color1, color2)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Syntax: /veh <carid> <color 1> <color 2>");
if (vehid < 400 || vehid > 611) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid car id! [Car ID's range from 400 -> 611]");
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, ang);
vCar[playerid] = CreateVehicle(vehid, x + 3, y, z, ang, color1, color2);
PutPlayerInVehicle(playerid, vCar[playerid], 0);
Printf("Vehicle ID: %i", vehid);
format(admstring, sizeof(admstring), "AdmCMD: %s has spawned a %s (%d) (%d total cars).", GetName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], vehid, vCar[playerid]);
SMA(COLOR_LIGHTRED, admstring);
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.
Re: Veh command problem -
Byonic - 21.03.2018
I fixed it already, the vCar var was causing issues.