help command /veh
#1

Hello as the Title say i need help with this command /veh if some1 are experianced with this i wud love to get help here is what i want help with

first of all i just want the command to work like > /veh [ID] atm i have to use /veh [ID] [color1] [Color2]

and also when you write for example /veh 411
you spawn a infernus and atm you spawn outside it i want the player to spawn inside it!

please help me with this since iam not experianced to do it myself
i will ofcourse add you reputition!


Here is my code
Код:
CMD:veh(playerid, params[]) {
	if (PlayerInfo[playerid][pAdmin] >= 4) {

		new
			iVehicle,
			iColors[2];

		if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
		}
		else if(!(400 <= iVehicle <= 611)) {
			SendClientMessageEx(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)) {
			SendClientMessageEx(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);
			VehicleFuel[CreatedCars[iIterator]] = 100.0;
			LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
			return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}
Reply
#2

Код:
CMD:veh(playerid, params[]) 
{
        if (PlayerInfo[playerid][pAdmin] < 4) return  SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        new iVehicle, iColors[2];
	if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
	if(iVehicle < 400 && iVehicle > 611) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
	if(iColors[0] < 0 && iColors[0] > 255) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified for color 1(IDs start at 0, and end at 255).");
        if(iColors[1] < 0 && iColors[1] > 255) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified for color 2(IDs start at 0, and end at 255).");
	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);
		        VehicleFuel[CreatedCars[iIterator]] = 100.0;
		        LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
		        SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
                }
	}
	return 1;
}
Reply
#3

i get this error


Код:
C:\Users\showarn\Desktop\Alexrp\gamemodes\bowlan.pwn(42014) : warning 217: loose indentation
C:\Users\showarn\Desktop\Alexrp\gamemodes\bowlan.pwn(42017) : warning 217: loose indentation
C:\Users\showarn\Desktop\Alexrp\gamemodes\bowlan.pwn(42018) : warning 217: loose indentation
C:\Users\showarn\Desktop\Alexrp\gamemodes\bowlan.pwn(42023) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Reply
#4

PutPlayerInVehicle
Reply
#5

somthing liket his?

Код:
PutPlayerInVehicle(giveplayerid,carid,seat);
Reply
#6

Eh, yes.
Just make it work for your code, obviously.
Reply
#7

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

        new
            iVehicle,
            iColors[2];

        if(sscanf(params, "iI(0)I(0)", iVehicle, iColors[0], iColors[1]))
            return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
        if(!(400 <= iVehicle <= 611))
            return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
        if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255))
            return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
        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);
            VehicleFuel[CreatedCars[iIterator]] = 100.0;
            LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
            PutPlayerInVehicle(playerid,CreatedCars[iIterator],0);
            return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    return 1;
}
Reply
#8

HEJ ALEXANDER
Reply
#9

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
pawn Код:
CMD:veh(playerid, params[]) {
    if (PlayerInfo[playerid][pAdmin] >= 4) {

        new
            iVehicle,
            iColors[2];

        if(sscanf(params, "iI(0)I(0)", iVehicle, iColors[0], iColors[1]))
            return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
        if(!(400 <= iVehicle <= 611))
            return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
        if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255))
            return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
        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);
            VehicleFuel[CreatedCars[iIterator]] = 100.0;
            LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
            PutPlayerInVehicle(playerid,CreatedCars[iIterator],0);
            return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    return 1;
}

Thank you worked great!!! rep added to both of you!
Reply
#10

is it possible to add to the script, when i use /veh [ID]

i spawn in the car (fixed)
and the engine starts (need help with that)

Here is my script

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

        new
            iVehicle,
            iColors[2];

        if(sscanf(params, "iI(0)I(0)", iVehicle, iColors[0], iColors[1]))
            return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
        if(!(400 <= iVehicle <= 611)) 
            return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
        if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) 
            return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
        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);
            VehicleFuel[CreatedCars[iIterator]] = 100.0;
            LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
            PutPlayerInVehicle(playerid,CreatedCars[iIterator],0);
            return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)