[CMD] /veh
#1

So practically.. . The vehicle does NOT spawn...

Error Tries:

- no Error with Pawno
- no Errors with the Logs.


COMMAND:

Код:
CMD:veh(playerid, params[]) {
	if (PlayerInfo[playerid][pAdmin] >= 2) {

		new
			iVehicle,
			iColors[2];

		if(sscanf(params, "iI(0)I(0)", iVehicle, iColors[0], iColors[1])) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
		}
		else if(!(400 <= iVehicle <= 611)) {
			SendClientMessage(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
		}
		else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
			SendClientMessage(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
		}
		else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {

			new
				Float: fVehPos[4];

			GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
			GetPlayerFacingAngle(playerid, fVehPos[3]);
			CreatedCars[iIterator] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
			LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
			SetVehicleVirtualWorld(CreatedCars[iIterator], GetVehicleVirtualWorld(CreatedCars[iIterator]));
			return SendClientMessage(playerid, COLOR_GREY, "Vehicle spawned!");
		}
	}
	else SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}
Reply
#2

Remove LinkVehicleToInterior and SetVehicleVirtualWorld
Reply
#3

Try this:

PHP код:
CMD:veh(playeridparams[]) {
    if(
PlayerInfo[playerid][pAdmin] >= 2) {
        new
            
iVehicle,
            
iColors[2] = { -1, -};
        if(
sscanf(params"iII"iVehicleiColors[0], iColors[1]))
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: /veh [model ID] [(optional) color 1] [(optional) color 2]");
        }
        else if(!(
400 <= iVehicle <= 611))
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid model specified (model IDs start at 400, and end at 611).");
        }
          else if(
iColors[0] < -|| iColors[0] > 255 || iColors[1] < -|| iColors[1] > 255) {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid colour specified (IDs start at -1, and end at 255).");
        }
        else if(
CreatedCarsCount >= 50)
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Only a maximum of 50 cars can be admin spawned at a time. Use /destroycar or /destroycars");
            return 
1;
        }
        else for(new 
iIteratoriIterator sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID)
        {
            new
                
FloatfVehPos[4];
            
GetPlayerPos(playeridfVehPos[0], fVehPos[1], fVehPos[2]);
            
GetPlayerFacingAngle(playeridfVehPos[3]);
            
CreatedCars[iIterator] = CreateVehicle(iVehiclefVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
            
CreatedCarsCount++;
            
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
            return 
SendClientMessage(playeridCOLOR_GREY"Vehicle spawned!");
        }
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

Reply
#4

Quote:
Originally Posted by XBrianX
Посмотреть сообщение
Try this:

PHP код:
CMD:veh(playeridparams[]) {
    if(
PlayerInfo[playerid][pAdmin] >= 2) {
        new
            
iVehicle,
            
iColors[2] = { -1, -};
        if(
sscanf(params"iII"iVehicleiColors[0], iColors[1]))
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: /veh [model ID] [(optional) color 1] [(optional) color 2]");
        }
        else if(!(
400 <= iVehicle <= 611))
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid model specified (model IDs start at 400, and end at 611).");
        }
          else if(
iColors[0] < -|| iColors[0] > 255 || iColors[1] < -|| iColors[1] > 255) {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid colour specified (IDs start at -1, and end at 255).");
        }
        else if(
CreatedCarsCount >= 50)
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Only a maximum of 50 cars can be admin spawned at a time. Use /destroycar or /destroycars");
            return 
1;
        }
        else for(new 
iIteratoriIterator sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID)
        {
            new
                
FloatfVehPos[4];
            
GetPlayerPos(playeridfVehPos[0], fVehPos[1], fVehPos[2]);
            
GetPlayerFacingAngle(playeridfVehPos[3]);
            
CreatedCars[iIterator] = CreateVehicle(iVehiclefVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
            
CreatedCarsCount++;
            
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
            return 
SendClientMessage(playeridCOLOR_GREY"Vehicle spawned!");
        }
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

This guy asked for help with same cmd few days ago and u posted same and it didnt work out for him lol.


Quote:
Originally Posted by XBrianX
Посмотреть сообщение
Maybe this will work?
PHP код:
CMD:veh(playeridparams[]) {
    if(
PlayerInfo[playerid][pAdmin] >= 2) {
                  new
            
iVehicle,
            
iColors[2] = { -1, -};
        if(
sscanf(params"iII"iVehicleiColors[0], iColors[1]))
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: /veh [model ID] [(optional) color 1] [(optional) color 2]");
        }
        else if(!(
400 <= iVehicle <= 611))
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid model specified (model IDs start at 400, and end at 611).");
        }
          else if(
iColors[0] < -|| iColors[0] > 255 || iColors[1] < -|| iColors[1] > 255) {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid colour specified (IDs start at -1, and end at 255).");
        }
        else if(
CreatedCarsCount >= 50)
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Only a maximum of 50 cars can be admin spawned at a time. Use /destroycar or /destroycars");
            return 
1;
        }
        else for(new 
iIteratoriIterator sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID)
        {
            new
                
FloatfVehPos[4];
            
GetPlayerPos(playeridfVehPos[0], fVehPos[1], fVehPos[2]);
            
GetPlayerFacingAngle(playeridfVehPos[3]);
            
CreatedCars[iIterator] = CreateVehicle(iVehiclefVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
            
CreatedCarsCount++;
            
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
            return 
SendClientMessage(playeridCOLOR_GREY"Vehicle spawned!");
        }
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

but try this

PHP код:
CMD:veh(playeridparams[]) {
    if (
PlayerInfo[playerid][pAdmin] >= 2) {
        new
            
iVehicle,
            
iColors[2];
        if(
sscanf(params"iii"iVehicleiColors[0], iColors[1])) {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: /veh [model ID] [color 1] [color 2]");
        }
        else if(!(
400 <= iVehicle <= 611)) {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid model specified (model IDs start at 400, and end at 611).");
        }
        else if(!(
<= iColors[0] <= 255 && <= iColors[1] <= 255)) {
            
SendClientMessage(playeridCOLOR_GRAD2"Invalid colour specified (IDs start at 0, and end at 255).");
            new
                
FloatfVehPos[4];
            
GetPlayerPos(playeridfVehPos[0], fVehPos[1], fVehPos[2]);
            
GetPlayerFacingAngle(playeridfVehPos[3]);
            
CreateVehicle(iVehiclefVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
            return 
SendClientMessage(playeridCOLOR_GREY"Vehicle spawned!");
        }
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You are not authorized to use that command!");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)