28.08.2015, 22:39
the following cmd is supposed to change the car colour
and this one is suppose to spawn the car
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
Код:
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; }
Код:
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; }
Thanks