29.09.2011, 03:20
Hi guys i need a little help with this code in changing it from a command to if you have an fire extinguisher or your in a fire truck you put it out.
pawn Код:
CMD:putoutfire(playerid)
{
new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2, Float:X3, Float:Y3, Float:Z3, Float:X4, Float:Y4, Float:Z4, Float:X5, Float:Y5, Float:Z5;
GetObjectPos(o1, X1, Y1, Z1);
GetObjectPos(o2, X2, Y2, Z2);
GetObjectPos(o3, X3, Y3, Z3);
GetObjectPos(o4, X4, Y4, Z4);
GetObjectPos(o5, X5, Y5, Z5);
if(FireInProgress == false) return SendClientMessage(playerid, 0xFFFFFF, "ERROR: There are no fires in progress");
if(IsPlayerInRangeOfPoint(playerid, 20.0, X1, Y1, Z1) == 0 || IsPlayerInRangeOfPoint(playerid, 20.0, X2, Y2, Z2) == 0 || IsPlayerInRangeOfPoint(playerid, 20.0, X3, Y3, Z3) == 0 || IsPlayerInRangeOfPoint(playerid, 20.0, X4, Y4, Z4) == 0 || IsPlayerInRangeOfPoint(playerid, 20.0, X5, Y5, Z5) == 0) return SendClientMessage(playerid, 0xFFFFFF, "ERROR: You are not near the fire");
if(Reload[playerid] != false) return SendClientMessage(playerid, 0xFFFFFF, "ERROR: You need to wait before putting the fire again");
if(GetPlayerSkin(playerid) == 277 || GetPlayerSkin(playerid) == 278 || GetPlayerSkin(playerid) == 279)
{
if(FireStatus < 0)
{
KillFire();
return 1;
}
if(FireStatus < 80)
{
DestroyObject(o1);
return 1;
}
if(FireStatus < 60)
{
DestroyObject(o1);
return 1;
}
if(FireStatus < 40)
{
DestroyObject(o1);
return 1;
}
if(FireStatus < 20)
{
DestroyObject(o1);
return 1;
}
if(IsPlayerInAnyVehicle(playerid) == 1)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 407)
{
FireStatus = FireStatus - 15;
SetTimerEx("ReloadFun", 30000, false, "i", playerid);
Reload[playerid] = true;
SendClientMessage(playerid, 0xFFFFFF, "You managed to put out some of the fire ((reload 30 seconds))");
}
}
else if(GetPlayerWeapon(playerid) == 42)
{
FireStatus = FireStatus - 5;
SetTimerEx("ReloadFun", 15000, false, "i", playerid);
Reload[playerid] = true;
SendClientMessage(playerid, 0xFFFFFF, "You managed to put out some of the fire ((reload 15 seconds))");
}
else return SendClientMessage(playerid, 0xFFFFFF, "ERROR: You must be in a Firetruck or using a fire extingusher");
}
else return SendClientMessage(playerid, 0xFFFFFF, "You are not in a fireman suit");
return 1;
}