SA-MP Forums Archive
Vehicle ID - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle ID (/showthread.php?tid=529724)



Vehicle ID - Sarra - 03.08.2014

pawn Код:
CMD:createveh(playerid, params[])
{
    new
        vehid,colorid1,colorid2;
    new
        Float:x,Float:y,Float:z;
    if (sscanf(params, "iii", vehid, colorid1, colorid2)) SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createveh [Vehicle ID] [Color 1 ID] [Color 2 ID]");
    else if (vehid== INVALID_VEHICLE_ID) SendClientMessage(playerid, 0xFF0000AA, "Invalid Vehicle ID");// needs Fix
    else
    {
        GetPlayerPos(playerid, x, y, z);
        CreateVehicle(vehid, x+1, y+1, z, 0, colorid1, colorid2, 1);
        SetVehicleParamsEx(??, 0, 0, 0, 0, 0, 0, 0);
    }
    return 1;
}
what should I type instead of the "??" in SetVehicleParamsEx, I want it to apply thoses status on the vehicle created using /createveh
and what's meant by objective (last param in SetVehicleParamEx
thanks


Re: Vehicle ID - Stanford - 03.08.2014

vehid instead of the Plus you have some errors in these code, put returns before sendclientmessage


Re: Vehicle ID - Sarra - 03.08.2014

actually I'm not getting any errors and it works fine in all cases(if I delete the setvehicleparamsex)
++ vehid = the Vehicle model ID not the vehicle ID


AW: Vehicle ID - Stanford - 03.08.2014

No it doesn't work fine, it will send the sscanf message all the time it's not in brackets or anything.
I am on phone wish if I am on PC to correct it for you.
About veh id, create a new new for example new carid; and near the creating do carid = createvehicle(....) and use carid at setvehicleparamsex


Re: Vehicle ID - Sarra - 03.08.2014

alright +rep for the vehid solution, about the code it works fine , I tested it 1000 times (I'm a beginner anyway, I'll add returns but it works fine, really)


Re: Vehicle ID - Stanford - 03.08.2014

At an advanced stage you will listen to me and add returns


Re: Vehicle ID - dirigent00 - 03.08.2014

Try this, it's not tested:

Код:
CMD:createveh(playerid, params[])
{
	new vid, col1, col2;
	if(sscanf(params, "iii", vid, col1, col2)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createveh [Vehicle ID] [Color 1 ID] [Color 2 ID]");
	if(400 < (vid) > 611) return SendClientMessage(playerid, 0xFFFFFFFF, "INVALID VEHICLE ID!");
	else
	{
		new Float:pos[3], car;
		GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		car = CreateVehicle(vid, pos[0]+1.0, pos[1]+1.0, pos[2], 0.0, col1, col2, 0);
		SetVehicleParamsEx(car, 0, 0, 0, 0, 0, 0, 0);
	}
	return 1;
}



Re: Vehicle ID - Stanford - 03.08.2014

That's what I exactly told her at an earlier stage.


Re: Vehicle ID - dirigent00 - 03.08.2014

Quote:
Originally Posted by Stanford
Посмотреть сообщение
vehid instead of the ?? Plus you have some errors in these code, put returns before sendclientmessage
SetVehicleParamsEx will set parameteres for vehicleid, NOT for modelid, as you written it in this post.


Re: Vehicle ID - Sarra - 03.08.2014

Quote:
Originally Posted by dirigent00
Посмотреть сообщение
SetVehicleParamsEx will set parameteres for vehicleid, NOT for modelid, as you written it in this post.
Yes he corrected it, If you check the next reply he gave me the right answer!