/v cmd
#1

i want a cmd like /v (veh name or id)(color1)(color2)

if you can help me so please help me
Reply
#2

I have made a command but you can only spawn cars by ID.I don't know if you want it.Anyway here it is:

pawn Код:
CMD:v(playerid, params[])
{
    new vehicle, carcolor1, carcolor2, Float:x, Float:y, Float:z, Float:Angle;
    if(sscanf(params, "iii", vehicle,carcolor1, carcolor2)) return SendClientMessage(playerid, -1, "USAGE: /v [carID] [carcolor1] [carcolor2]");
    if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, -1, "Vehicle ID can't be below 400 and higher than 611");
    if(carcolor1 < 0 || carcolor1 > 129) return SendClientMessage(playerid, -1, "Carcolor1 can't be below 0 and higher than 129");
    if(carcolor2 < 0 || carcolor2 > 129) return SendClientMessage(playerid, -1, "Carcolor2 can't be below 0 and higher than 129");
    GetPlayerPos(playerid, x,y,z);
    GetPlayerFacingAngle(playerid, Angle);
    vehicle = CreateVehicle(vehicle, x,y,z, Angle, carcolor1, carcolor2, 1);
    PutPlayerInVehicle(playerid, vehicle, 0);
    return 1;
}
Reply
#3

You have that command in fsdebug located here -> https://sampforum.blast.hk/showthread.php?tid=2751

I got it out for you:

Код:
dcmd_v(playerid, params[])
{
	new
		idx,
		iString[ 128 ];
	
	if ( gPlayerStatus[ playerid ] != 0 )
	{
		format				( iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] );
		SendClientMessage	( playerid, COLOR_RED, iString );
		
		return true;
	}
	
	if ( params[ 0 ] == '\0' )	// Same effect as a !strlen check.
		return SendClientMessage( playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME" );

	//***************
	// Fix by Mike! *
	//***************
	
	idx = GetVehicleModelIDFromName( params );

	if( idx == -1 )
	{
		idx = strval(iString);

		if ( idx < MIN_VEHI_ID || idx > MAX_VEHI_ID )
			return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
	}

	new
		Float:x,
		Float:y,
		Float:z,
		Float:a;

	GetPlayerPos(playerid, x, y, z);
	GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
	GetPlayerFacingAngle(playerid, a);

	curPlayerVehM[playerid] = idx;

	curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
	LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));

 	curServerVehP[curPlayerVehI[playerid]][spawn] 	= true;
	curServerVehP[curPlayerVehI[playerid]][vmodel]	= idx;
	curServerVehP[curPlayerVehI[playerid]][vInt]    = GetPlayerInterior(playerid);

	format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);

	SendClientMessage(playerid, COLOR_GREEN, iString);

	return true;
}
Reply
#4

Quote:
Originally Posted by JohnYoti
Посмотреть сообщение
I have made a command but you can only spawn cars by ID.I don't know if you want it.Anyway here it is:

pawn Код:
CMD:v(playerid, params[])
{
    new vehicle, carcolor1, carcolor2, Float:x, Float:y, Float:z, Float:Angle;
    if(sscanf(params, "iii", vehicle,carcolor1, carcolor2)) return SendClientMessage(playerid, -1, "USAGE: /v [carID] [carcolor1] [carcolor2]");
    if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, -1, "Vehicle ID can't be below 400 and higher than 611");
    if(carcolor1 < 0 || carcolor1 > 129) return SendClientMessage(playerid, -1, "Carcolor1 can't be below 0 and higher than 129");
    if(carcolor2 < 0 || carcolor2 > 129) return SendClientMessage(playerid, -1, "Carcolor2 can't be below 0 and higher than 129");
    GetPlayerPos(playerid, x,y,z);
    GetPlayerFacingAngle(playerid, Angle);
    vehicle = CreateVehicle(vehicle, x,y,z, Angle, carcolor1, carcolor2, 1);
    PutPlayerInVehicle(playerid, vehicle, 0);
    return 1;
}
pawn Код:
F:\AdIb world\samp servers\Simple DM.Stunt.Parkour.Derby\gamemodes\veh.pwn(94) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

You need ZCMD command processor to compile that code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)