Custom vehicle spawnposition change
#1

Hey people, so basicly what I got now is when I /customvehicle blabla it goes to the given coordinates. How do I make it like it goes to the current position of the player you are making the /customvehicle for? Please help it.

Current code:
Код:
CMD:customvehicle(playerid, params[])
{
	new playerb, string[128], modelid, slot;
	if(sscanf(params, "udd", playerb, slot, modelid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /customvehicle [playerid] [1-3] [modelid]");
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_GREY, "Vehicles are between 400 and 611.");
   	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(slot == 1)
	{
		PlayerInfo[playerb][pVeh] = CreateVehicle(modelid, 532.3726,-1287.4926,17.2422,272.3125,0,0,32000);
	 	SetVehicleParamsEx(PlayerInfo[playerb][pVeh], 0, 0, 0, 1, 0, 0, 0);
	 	PlayerInfo[playerb][vLocked] = 1;
	 	PlayerInfo[playerb][vModel] = modelid;
		GetVehiclePos(PlayerInfo[playerb][pVeh], PlayerInfo[playerb][vX], PlayerInfo[playerb][vY], PlayerInfo[playerb][vZ]);
		GetVehicleZAngle(PlayerInfo[playerb][pVeh], PlayerInfo[playerb][vA]);
		PlayerInfo[playerb][vC1] = 0;
		PlayerInfo[playerb][vC2] = 0;
		format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created a custom vehicle for (Slot 1) %s.", NORPN(playerid), NORPN(playerb));
		SendAdminMessage(COLOR_DARKRED, 1, string);
	}
	else if(slot == 2)
	{
	        PlayerInfo[playerb][pVVeh] = CreateVehicle(modelid, 532.3726,-1287.4926,17.2422,272.3125,0,0,32000);
		    SetVehicleParamsEx(PlayerInfo[playerb][pVVeh], 0, 0, 0, 1, 0, 0, 0);
		    PlayerInfo[playerb][vVLocked] = 1;
		    PlayerInfo[playerb][vVModel] = modelid;
			GetVehiclePos(PlayerInfo[playerb][pVVeh], PlayerInfo[playerb][vVX], PlayerInfo[playerb][vVY], PlayerInfo[playerb][vVZ]);
			GetVehicleZAngle(PlayerInfo[playerb][pVVeh], PlayerInfo[playerb][vVA]);
			PlayerInfo[playerb][vVC1] = 0;
			PlayerInfo[playerb][vVC2] = 0;
			format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created a custom vehicle (Slot 2) for %s.", NORPN(playerid), NORPN(playerb));
			SendAdminMessage(COLOR_DARKRED, 1, string);
	}
	else if(slot == 3)
	{
	 		PlayerInfo[playerb][pBVeh] = CreateVehicle(modelid, 532.3726,-1287.4926,17.2422,272.3125,0,0,32000);
	    	SetVehicleParamsEx(PlayerInfo[playerb][pBVeh], 0, 0, 0, 1, 0, 0, 0);
	    	PlayerInfo[playerb][vBLocked] = 1;
	    	PlayerInfo[playerb][vBModel] = modelid;
			GetVehiclePos(PlayerInfo[playerb][pBVeh], PlayerInfo[playerb][vBX], PlayerInfo[playerb][vBY], PlayerInfo[playerb][vBZ]);
			GetVehicleZAngle(PlayerInfo[playerb][pBVeh], PlayerInfo[playerb][vBA]);
			PlayerInfo[playerb][vBC1] = 0;
			PlayerInfo[playerb][vBC2] = 0;
			format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created a custom vehicle (Slot 3) for %s.", NORPN(playerid), NORPN(playerb));
			SendAdminMessage(COLOR_DARKRED, 1, string);
Reply


Messages In This Thread
Custom vehicle spawnposition change - by Songason - 27.10.2013, 21:21
Re: Custom vehicle spawnposition change - by danilang9 - 27.10.2013, 21:30
Re: Custom vehicle spawnposition change - by Patrick - 27.10.2013, 21:41
Re: Custom vehicle spawnposition change - by Songason - 27.10.2013, 21:52
Re: Custom vehicle spawnposition change - by Patrick - 27.10.2013, 21:57
Re: Custom vehicle spawnposition change - by Songason - 27.10.2013, 21:58
Re: Custom vehicle spawnposition change - by Patrick - 27.10.2013, 22:01
Re: Custom vehicle spawnposition change - by danilang9 - 27.10.2013, 22:03
Re: Custom vehicle spawnposition change - by Patrick - 27.10.2013, 22:10
Re: Custom vehicle spawnposition change - by Songason - 27.10.2013, 22:38

Forum Jump:


Users browsing this thread: 1 Guest(s)