[AJUDA] Comando de plantar bomba
#7

Olha, aqui uma fs de Bomba excelent do Ambrуsio !
vocк vai gostar
pawn Код:
/*
      AA       MMMM          MM  BBBBBBB   RRRRRR      00     SSSSSS  II    00
     AAAA      MM MM      MM MM  BB    BB  RR   RR   00  00   SS      II  00  00
    AA  AA     MM   MM  MM   MM  BB    BB  RR   RR  00    00  SS      II 00   00
   AA    AA    MM     MM     MM  BBBBBB    RRRRR    00    00  SSSSSS  II 00   00
  AAAAAAAAAA   MM            MM  BB    BB  RR  RR   00    00      SS  II 00   00
 AA        AA  MM            MM  BB    BB  RR   RR   00  00       SS  II  00 00
AA          AA MM            MM  BBBBBBB   RR    RR    00     SSSSSS  II   00

*/


/*  Sistema de Bomba.
    Comandos /plantarbomba e /desativarbomba
*/


#include <a_samp>
//==============================================================================
new bombtimer[MAX_PLAYERS];
new Float: BombX[MAX_PLAYERS], Float: BombY[MAX_PLAYERS], Float: BombZ[MAX_PLAYERS], BombObject[MAX_PLAYERS], bool: BombArmed[MAX_PLAYERS];
forward BombTimer(playerid);
//==============================================================================
public OnFilterScriptInit()
{
    print("\nSistema de Bomba by Ambrуsio Ligado\n");
    return 1;
}
//==============================================================================
public OnFilterScriptExit()
{
    print("\nSistema de Bomba by Ambrуsio Desligado\n");
    return 1;
}
//==============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/plantarbomba", true)==0)
    {
        if(BombArmed[playerid] == false)
        {
            GetPlayerPos(playerid, BombX[playerid], BombY[playerid], BombZ[playerid]);
            GetXYInFrontOfPlayer(playerid, BombX[playerid], BombY[playerid], 0.7);
            SendClientMessage(playerid, 0x0066FFAA, "Bomba Plantada (explodirб em 20 segundos).");
            SendClientMessage(playerid, 0x0066FFAA, "Para desativa-la use: /desativarbomba.");
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombObject[playerid] = CreateObject(1252, BombX[playerid], BombY[playerid], BombZ[playerid] - 0.8,270,0,0);
            bombtimer[playerid] = SetTimerEx("BombTimer",20000,0, "d", playerid);
            BombArmed[playerid] = true;
        }
        else
        {
            SendClientMessage(playerid, 0xCC0000AA, "Vocк sу pode colocar uma bomba de cada vez!");
        }
        return 1;
    }
   
    if (strcmp(cmdtext, "/desativarbomba", true)==0)
    {
        if(PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15 && PlayerInfo[playerid][pMembro] != 23 && PlayerInfo[playerid][pLider] != 23)
        if(IsPlayerInRangeOfPoint(playerid, 2.0,BombX[playerid], BombY[playerid], BombZ[playerid]))
        {
            KillTimer(bombtimer[playerid]);
            SendClientMessage(playerid, 0xAFAFAFAA, "Bomba desativada");
            DestroyObject(BombObject[playerid]);
            BombArmed[playerid] = false;
        }
        else
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "Vocк precisa estar proximo a bomba para desativa-la.");
        }
        return 1;
    }
    return 0;
}
//==============================================================================
public BombTimer(playerid)
{
    CreateExplosion(BombX[playerid], BombY[playerid], BombZ[playerid], 10, 15);
    SendClientMessage(playerid, 0xAFAFAFAA, "Bomba explodida.");
    DestroyObject(BombObject[playerid]);
    BombArmed[playerid] = false;
    return 1;
}
//==============================================================================
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;

    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);

    if (GetPlayerVehicleID(playerid)) {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
//==============================================================================
Ajudei ? + RЈPp
Reply


Messages In This Thread
[AJUDA] Comando de plantar bomba - by alanbr00 - 19.04.2012, 10:28
Re: [AJUDA] Comando de plantar bomba - by Trigo - 19.04.2012, 14:57
Re: [AJUDA] Comando de plantar bomba - by WLSF - 19.04.2012, 15:05
Re: [AJUDA] Comando de plantar bomba - by Trigo - 19.04.2012, 16:08
Re: [AJUDA] Comando de plantar bomba - by alanbr00 - 19.04.2012, 17:03
Re: [AJUDA] Comando de plantar bomba - by alanbr00 - 20.04.2012, 06:42
Respuesta: [AJUDA] Comando de plantar bomba - by leosivi - 20.04.2012, 11:46
Re: [AJUDA] Comando de plantar bomba - by xPaulistaa - 20.04.2012, 16:18
Re: [AJUDA] Comando de plantar bomba - by alanbr00 - 21.04.2012, 06:22
Re: [AJUDA] Comando de plantar bomba - by kratty - 21.04.2012, 06:39

Forum Jump:


Users browsing this thread: 1 Guest(s)