Help with code
#1

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;

}
Reply
#2

So you don't want a command, you want the weapons? I don't understand mate sorry.

Nineteen seconds to wait until I can post!
Reply
#3

Yes that's what I want. You have to have a fire extinguisher or been in a firetruck to put out the fires.
Reply
#4

Код:
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);

new vehid = GetPlayerVehicleID(playerid);
new vehicle =GetVehicleModel(vehid);
if(vehicle == 407 || GetPlayerWeapon(playerid) == 42))
{


    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;

}
[/code]
Reply
#5

You have to have a fire extinguisher or been in a firetruck to put out the fires. I don't want the command just to be able to put the fire out if you have a fire extinguisher or you are in the firetruck using the water canon.
Reply
#6

I dont think anyone has Successfully Put out any fire sources with a water cannon..
Reply
#7

Well if anyone could make it where you have to have a fire extinguisher to put out the flames instead of a command. I know it can be done I have seen video with particles that do this but aren't released.
Reply
#8

https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector
Reply
#9

bump i really need this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)