Vehicle command
#1

Hey, guys maybe I'm too tired to see an error myself but I get argument type mismatches on all these lines.

Код:
else if(GetVehicleModelIDFromName(car) == -1) return SendClientMessage(playerid,COLOR_GREY,"SERVER: Invalid car name!");
 if(!strcmp(carcolor1,"red",true)) return carcolor1 = 3;
 else if(!strcmp(carcolor1,"blue",true)) return carcolor1 = 7;
 else if(!strcmp(carcolor1,"black",true)) return carcolor1 = 0;
 else if(!strcmp(carcolor1,"pink",true)) return carcolor1 = 126;
 else if(!strcmp(carcolor1,"gray",true)) return carcolor1 = 56;
 else if(!strcmp(carcolor1,"yellow",true)) return carcolor1 = 6;
 else if(!strcmp(carcolor1,"purple",true)) return carcolor1 = 5;
 else if(!strcmp(carcolor1,"turquoise",true)) return carcolor1 = 2;
 else if(!strcmp(carcolor1,"white",true)) return carcolor1 = 1;
 else if(!strcmp(carcolor1,"brown",true)) return carcolor1 = 109;
 else if(!strcmp(carcolor1,"green",true)) return carcolor1 = 16;
 if(!strcmp(carcolor2,"red",true)) return carcolor2 = 3;
 else if(!strcmp(carcolor2,"blue",true)) return carcolor2 = 7;
 else if(!strcmp(carcolor2,"black",true)) return carcolor2 = 0;
 else if(!strcmp(carcolor2,"pink",true)) return carcolor2 = 126;
 else if(!strcmp(carcolor2,"gray",true)) return carcolor2 = 56;
 else if(!strcmp(carcolor2,"yellow",true)) return carcolor2 = 6;
 else if(!strcmp(carcolor2,"purple",true)) return carcolor2 = 5;
 else if(!strcmp(carcolor2,"turquoise",true)) return carcolor2 = 2;
 else if(!strcmp(carcolor2,"white",true)) return carcolor2 = 1;
 else if(!strcmp(carcolor2,"brown",true)) return carcolor2 = 109;
 else if(!strcmp(carcolor2,"green",true)) return carcolor2 = 16;
 GetPlayerPos(playerid,X,Y,Z);
 CreateVehicle(GetVehicleModelIDFromName(car),X,Y,Z,0,carcolor1,carcolor2,60000);
my whole command is this.


Код:
dcmd_veh(playerid,params[])
{
 new car,carcolor1,carcolor2,Float:X,Float:Y,Float:Z;
 if(GetPlayerAdminLevel(playerid) < 3) return aDeny(playerid);
 else if(sscanf(params,"sss",car,carcolor1,carcolor2)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /veh [car_name][car_colour][car_outline_color]");
 else if(GetVehicleModelIDFromName(car) == -1) return SendClientMessage(playerid,COLOR_GREY,"SERVER: Invalid car name!");
 if(!strcmp(carcolor1,"red",true)) return carcolor1 = 3;
 else if(!strcmp(carcolor1,"blue",true)) return carcolor1 = 7;
 else if(!strcmp(carcolor1,"black",true)) return carcolor1 = 0;
 else if(!strcmp(carcolor1,"pink",true)) return carcolor1 = 126;
 else if(!strcmp(carcolor1,"gray",true)) return carcolor1 = 56;
 else if(!strcmp(carcolor1,"yellow",true)) return carcolor1 = 6;
 else if(!strcmp(carcolor1,"purple",true)) return carcolor1 = 5;
 else if(!strcmp(carcolor1,"turquoise",true)) return carcolor1 = 2;
 else if(!strcmp(carcolor1,"white",true)) return carcolor1 = 1;
 else if(!strcmp(carcolor1,"brown",true)) return carcolor1 = 109;
 else if(!strcmp(carcolor1,"green",true)) return carcolor1 = 16;
 if(!strcmp(carcolor2,"red",true)) return carcolor2 = 3;
 else if(!strcmp(carcolor2,"blue",true)) return carcolor2 = 7;
 else if(!strcmp(carcolor2,"black",true)) return carcolor2 = 0;
 else if(!strcmp(carcolor2,"pink",true)) return carcolor2 = 126;
 else if(!strcmp(carcolor2,"gray",true)) return carcolor2 = 56;
 else if(!strcmp(carcolor2,"yellow",true)) return carcolor2 = 6;
 else if(!strcmp(carcolor2,"purple",true)) return carcolor2 = 5;
 else if(!strcmp(carcolor2,"turquoise",true)) return carcolor2 = 2;
 else if(!strcmp(carcolor2,"white",true)) return carcolor2 = 1;
 else if(!strcmp(carcolor2,"brown",true)) return carcolor2 = 109;
 else if(!strcmp(carcolor2,"green",true)) return carcolor2 = 16;
 GetPlayerPos(playerid,X,Y,Z);
 CreateVehicle(GetVehicleModelIDFromName(car),X,Y,Z,0,carcolor1,carcolor2,60000);
 SendClientMessage(playerid,COLOR_GREY,"SERVER: Vehicle Spawned!");
 return 1;
}
Reply
#2

You're trying to compare an integer value with a string, which just won't work
Reply
#3

Figured that was my problem, so should I make two string variables, then if they equal say red then the integer on‌e = 3 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)