vehicleid = GetPlayerVehicleID(playerid);
COMMAND:load(playerid,vehicleid, params[])
{
new id;
id = GetPlayerVehicleID(playerid);
if(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid,x,y,z);
AddVehicleMissiles(id,2.0,-1.05,0.0);
VehicleFire[id] = 0;
}
return 1;
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)))
if(GetVehicleModel(id) == //modelid)
stock AddVehicleMissiles(vehicleid,Float:offsetx,Float:offsetz)
{
if(!VehicleFire[vehicleid])
{
new Float:x,Float:u;
GetVehiclePos(vehicleid,x,u,u);
if(x != 0)
{
if(!IsValidObject(VehicleBomb[vehicleid][1]))
{
VehicleBomb[vehicleid][0] = CreateObject(3790,2.1,1.7,-1.0,0,0,0,300.0);
VehicleBomb[vehicleid][1] = CreateObject(3790,2.1,1.7,-1.0,0,0,0,300.0);
AttachObjectToVehicle(VehicleBomb[vehicleid][0],vehicleid,offsetx,1,offsetz,2,0,270);
AttachObjectToVehicle(VehicleBomb[vehicleid][1],vehicleid,-offsetx,1,offsetz,2,0,270);
VehicleOffsetX[vehicleid] = offsetx;
VehicleOffsetZ[vehicleid] = offsetz;
return 1;
}
}
}
return 0;
}
COMMAND:unload(playerid,vehicleid, params[])
{
new id;
id = GetPlayerVehicleID(playerid);
if(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
if(GetVehicleModel(id) == 476)
{
DestroyObject(VehicleBomb[id][0]);
DestroyObject(VehicleBomb[id][1]);
VehicleFire[id] = 1;
}
}
return 1;
}
COMMAND:load(playerid,vehicleid, params[])
{
new id;
id = GetPlayerVehicleID(playerid);
new
Float:x,
Float:y,
Float:z;
if(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
if(GetVehicleModel(id) == 476)
{
GetPlayerPos(playerid,x,y,z);
AddVehicleMissiles(id,2.0,-1.05,0.0);
VehicleFire[id] = 0;
}
}
return 1;
}
public VM_OnPlayerKeyStateChange(playerid,newkeys)
{
if((newkeys & MISSILE_FIRE_KEY) == (MISSILE_FIRE_KEY))
{
if(IsPlayerInAnyVehicle(playerid))
{
new id = GetPlayerVehicleID(playerid);
if(!VehicleFire[id])
{
if(id)
{
if(IsValidObject(VehicleBomb[id][1]))
{
new
Float:x,
Float:y,
Float:z,
Float:a;
VehicleFire[id] = 1;
if(IsValidObject(VehicleBomb[id][0]))
{
DestroyObject(VehicleBomb[id][0]);
GetVehiclePos(id,x,y,z);
GetVehicleZAngle(id,a);
a += 270;
z += VehicleOffsetZ[id];
x += (VehicleOffsetX[id] * floatsin(-a, degrees));
y += (VehicleOffsetX[id] * floatcos(-a, degrees));
VehicleBomb[id][0] = CreateObject(3790,x,y,z,2,0,a,300.0);
VehicleSmok[id][0] = CreateObject(18731,x,y,z-1.3,0,0,0,300.0);
a += 90;
x += (300 * floatsin(-a, degrees));
y += (300 * floatcos(-a, degrees));
MoveObject(VehicleBomb[id][0],x,y,z,MISSILE_SPEED);
MoveObject(VehicleSmok[id][0],x,y,z-1.3,MISSILE_SPEED);
SetTimerEx("VM_Explode",MISSILE_DETONATE_TIME,0,"dd",id,0);
VM_OnVehicleFire(id,0);
return 1;
}
DestroyObject(VehicleBomb[id][1]);
GetVehiclePos(id,x,y,z);
GetVehicleZAngle(id,a);
a += 90;
z += VehicleOffsetZ[id];
x += (VehicleOffsetX[id] * floatsin(-a, degrees));
y += (VehicleOffsetX[id] * floatcos(-a, degrees));
VehicleBomb[id][1] = CreateObject(3790,x,y,z,2,0,a+180,300.0);
VehicleSmok[id][1] = CreateObject(18731,x,y,z-1.3,0,0,0,300.0);
a += 270;
x += (300 * floatsin(-a, degrees));
y += (300 * floatcos(-a, degrees));
MoveObject(VehicleBomb[id][1],x,y,z,MISSILE_SPEED);
MoveObject(VehicleSmok[id][1],x,y,z-1.3,MISSILE_SPEED);
SetTimerEx("VM_Explode",MISSILE_DETONATE_TIME,0,"dd",id,1);
VM_OnVehicleFire(id,1);
return 1;
}
}
return 1;
}
}
}
return 1;
}
COMMAND:load(playerid,vehicleid, params[])
{
new id = GetPlayerVehicleID(playerid);
/*new
Float:x,
Float:y,
Float:z;*/ // Uncomment if you need it.
if(GetVehicleModel(id) == 476) // Removed previous conditional statement as there was no need for it.
{
// GetPlayerPos(playerid,x,y,z); // Uncomment if you need it.
VehicleFire[id] = 0;
AddVehicleMissiles(id,2.0,-1.05,0.0); // Since this checks if VehicleFire = 0, set the value of VehicleFire before you call it.
}
return 1;
}
pawn Код:
|