my vehicle system isnt working right ?! +Rep -
YoussefHammad - 28.08.2015
the following cmd is supposed to change the car colour
Код:
CMD:cvc(playerid,params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new color1[128];
new color2[128];
new Index;
color1 = strtok(params,Index);
color2 = strtok(params,Index);
if(sscanf(params,"ui",color1,color2))return SendClientMessage(playerid,-1,"USAGE:/cvc [color1] [color2]");
new string[128];
format(string, sizeof(string), "You have change the vehicle's color 1 to %d and color 2 to %d!",color1,color2);
SendClientMessage(playerid, -1, string);
new vehicleid = GetPlayerVehicleID(playerid);
ChangeVehicleColor(vehicleid, color1, color2);
}
else
{
SendClientMessage(playerid, -1, "You aren't in a vehicle!!");
}
return 1;
}
and this one is suppose to spawn the car
Код:
CMD:car(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(XCar[playerid] == 1)
{
new tmp[128], tmp2[128], tmp3[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
DestroyVehicle(Car[playerid]);
if(isnull(tmp))
{
SendClientMessage(playerid, -1, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
}
else
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
new int1;
int1 = GetPlayerInterior(playerid);
GetPlayerFacingAngle(playerid,Angle);
if(tmp > 400 && tmp < 611 && tmp != 520 && tmp != 476 && tmp != 432 && tmp != 425 && tmp != 447 && tmp != 501)
{
Car = CreateVehicle(tmp,X,Y,Z,Angle,tmp2,tmp3,-1);
LinkVehicleToInterior(Car,int1);
new string[128];
format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleName[tmp-400], tmp, tmp2,tmp3);
SendClientMessage(playerid,-1, string);
XCar[playerid] = 1;
}
else
{
new string2[128];
format(string2, sizeof(string2), "Invalid Vehicle ID!");
SendClientMessage(playerid,-1, string2);
}
}
}
}
else
{
SendClientMessage(playerid,-1,"You are already in a vehicle!");
}
return 1;
}
even though there's no errors. /CVC always change car colour 1 and 2 to 0 , and /car doesnt do anything , doesnt even return (Unkown Command!)
Thanks
Re: my vehicle system isnt working right ?! +Rep -
YoussefHammad - 29.08.2015
/cvc solved but i still dont know how to solve /car
Re: my vehicle system isnt working right ?! +Rep -
DarkLight - 29.08.2015
Try this
PHP код:
CMD:car(playerid,params[]) {
new tmp[128], tmp2[128], tmp3[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
if(isnull(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
new car, colour1, colour2, string[128];
if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
if(car < 400 || car > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
if(isnull(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
if(isnull(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); int1 = GetPlayerInterior(playerid);
LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
CMDMessageToAdmins(playerid,"CAR");
format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleName[car-400], car, colour1, colour2, X, Y, Z);
SaveToFile("CarSpawns",string);
format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleName[car-400], car, colour1, colour2);
PutPlayerInVehicle(playerid, LVehicleID, 0);
VehicleInfo[LVehicleID][Temp] = 1;
return SendClientMessage(playerid,blue, string);
}
Re: my vehicle system isnt working right ?! +Rep -
YoussefHammad - 29.08.2015
thats what i got
Код:
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(282) : error 017: undefined symbol "IsNumeric"
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(282) : error 017: undefined symbol "GetVehicleModelIDFromName"
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(291) : error 017: undefined symbol "VehicleInfo"
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(291) : warning 215: expression has no effect
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(291) : error 001: expected token: ";", but found "]"
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(291) : error 029: invalid expression, assumed zero
C:\Users\Youssf Hammad\Desktop\Server\filterscripts\veh(1).pwn(291) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.