Attaching Object to specific Vehicle
#3

Quote:
Originally Posted by KeenanRitchie
Посмотреть сообщение
My exampel
Код:
// Lights
new Light[MAX_VEHICLES];
new LightObject[MAX_VEHICLES];

CMD:light(playerid, params[])
{
	new veh, type[8], string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
	if(sscanf(params, "s[8]", type))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /light [position]");
		SendClientMessage(playerid, COLOR_WHITE, "POSITIONS: on|off");
		return 1;
	}
	if(Light[veh]) return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a Light attached.");
	veh = GetPlayerVehicleID(playerid);
	if(!strcmp(type, "on"))
	{
		if(Light[veh]) return SendClientMessage(playerid, COLOR_GREY, "There is already a light attached to this vehicle.");
        Light[veh] = 1;
        LightObject[veh] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
        AttachDynamicObjectToVehicle(LightObject[veh],veh, x, y, z, 0.0, 0.1, 0.0);
        format(string, sizeof(string), "* %s attaches a light to the car.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, Colors);
        return 1;
	else if(!strcmp(type, "off"))
	{
	    if(!Light[veh]) return SendClientMessage(playerid, COLOR_GREY, "There is no Lights attached to this vehicle.");
		Light[veh] = 0;
		DestroyDynamicObject(LightObject[veh]);
		format(string, sizeof(string), "* %s takes the Light off the car.", RPN(playerid));
		SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		return 1;
	}
	return 1;
}
I don't think that is going to help me, i just need a simple line of code, i just dont know what it is
Reply


Messages In This Thread
Attaching Object to specific Vehicle - by Lemonaidz - 24.02.2013, 02:05
Re: Attaching Object to specific Vehicle - by KeenanRitchie - 24.02.2013, 02:17
Re: Attaching Object to specific Vehicle - by Lemonaidz - 24.02.2013, 02:32
Re: Attaching Object to specific Vehicle - by Lemonaidz - 24.02.2013, 02:36
Re: Attaching Object to specific Vehicle - by Lemonaidz - 24.02.2013, 04:09

Forum Jump:


Users browsing this thread: 2 Guest(s)