[AJUDA] FS
#1

Bem queria um CMD para desarmar essa bomba

Agradeзo a Ajuda
Creditos: Bruno Mikio

pawn Код:
/*
                                         ************************************
                                         *       -Filterscript-             *
                                         *             Bomba Relуgio v1     *
                                         *       ______________________     *
                                         *       Feito por: Bruno Mikio     *
                                         ************************************

*/

//~  ** CONFIGURAЗВO **  ~//
#define BOMBATEMPO 30     // O Tempo que levarб para a bomba explodir (em segundos).
#define ARMARTEMPO 6     // O Tempo que levarб para armar a bomba (em segundos).

//~  ** INCLUDES **  ~//
#include <a_samp>


//~  ** CORES **  ~//
#define Amarelo 0xFFFF00AA


//~  ** OUTROS **  ~//
new BombaRelogio[MAX_PLAYERS];
new MS[MAX_PLAYERS];
new Segundos[MAX_PLAYERS];
new Minutos[MAX_PLAYERS];
new Float:BombX, Float:BombY, Float:BombZ;
new bombplanttime;
new bombtime;
new PlantouBomba[MAX_PLAYERS];

new Text:BombCount;

forward BombTime(playerid);
forward BombPlantTime(playerid);

//-----------------------------------------------------------------------------------------------------------------//

public OnFilterScriptInit()
{
    BombCount = TextDrawCreate(270.000000, 397.000000, "00:00:00");
    TextDrawBackgroundColor(BombCount, 255);
    TextDrawFont(BombCount, 2);
    TextDrawLetterSize(BombCount, 0.500000, 2.199999);
    TextDrawColor(BombCount, -1);
    TextDrawSetOutline(BombCount, 1);
    TextDrawSetProportional(BombCount, 1);
    return 1;
}



public OnPlayerCommandText(playerid, cmdtext[])
{

    if(strcmp(cmdtext, "/bomba", true) == 0)
    {
        if(PlantouBomba[playerid] == 1) return SendClientMessage(playerid, Amarelo, " Vocк jб plantou uma bomba. ");

        else
        {
            bombplanttime = SetTimerEx("BombPlantTime", ARMARTEMPO*1000, 0, "d", playerid);
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 0, 0, 0, 0);
            PlantouBomba[playerid] = true;
            return 1;
        }
    }
    return 0;
}


public BombPlantTime(playerid)
{
    GetPlayerPos(playerid, BombX, BombY, BombZ);
    BombaRelogio[playerid] = CreateObject(1252, BombX, BombY, BombZ-0.80, 270, 0, 0);
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    bombtime = SetTimerEx("BombTime", 9, 1, "d", playerid);
    MS[playerid] = 99;
    Segundos[playerid] = BOMBATEMPO;
    TextDrawShowForAll(Text:BombCount);
    KillTimer(bombplanttime);
    return 1;

}

public BombTime(playerid)
{
    MS[playerid]--;
    if(MS[playerid] == 0)
    {
        MS[playerid] = 99;
        Segundos[playerid]--;
    }

    if(Segundos[playerid] > 60)
    {
        new Segundos2 = Segundos[playerid] - 60;
        Segundos[playerid] = Segundos2;
        Minutos[playerid]++;
    }

    if(Segundos[playerid] == 0 && Minutos[playerid] > 0)
    {
        Segundos[playerid] = 59;
        Minutos[playerid]--;
    }

    if(Segundos[playerid] == 0 && MS[playerid] == 1)
    {
        PlantouBomba[playerid] = false;
        TextDrawHideForAll(Text:BombCount);
        DestroyObject(BombaRelogio[playerid]);

        CreateExplosion(BombX, BombY + random(8), BombZ + random(5), 6, 10.0);
        CreateExplosion(BombX + random(8), BombY, BombZ + random(5), 6, 10.0);
        CreateExplosion(BombX, BombY, BombZ, 6, 10.0);
        CreateExplosion(BombX, BombY - random(8), BombZ + random(5), 6, 10.0);
        CreateExplosion(BombX - random(8), BombY, BombZ + random(5), 6, 10.0);

        KillTimer(bombtime);
    }

    if(Segundos[playerid] < 10)
    {
        new count[10];
        format(count, sizeof(count), "00:0%i:%i", Segundos[playerid], MS[playerid]);
        TextDrawSetString(BombCount, count);
    }

    if(Segundos[playerid] >= 10)
    {
        new count[10];
        format(count, sizeof(count), "00:%i:%i", Segundos[playerid], MS[playerid]);
        TextDrawSetString(BombCount, count);
    }

    if(Minutos[playerid] < 10 && Segundos[playerid] < 10)
    {
        new count[10];
        format(count, sizeof(count), "0%i:0%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
        TextDrawSetString(BombCount, count);
    }

    if(Minutos[playerid] < 10 && Segundos[playerid] > 9)
    {
        new count[10];
        format(count, sizeof(count), "0%i:%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
        TextDrawSetString(BombCount, count);
    }

    if(Minutos[playerid] >= 10 && Segundos[playerid] > 9)
    {
        new count[10];
        format(count, sizeof(count), "%i:%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
        TextDrawSetString(BombCount, count);
    }

    if(Minutos[playerid] >= 10 && Segundos[playerid] < 10)
    {
        new count[10];
        format(count, sizeof(count), "%i:0%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
        TextDrawSetString(BombCount, count);
    }


    return 1;
}
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
    {
        if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
     }
        else
        {
            PlantouBomba[playerid] = false;
            return 1;
        }
    }
Reply
#3

pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
{
    if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
    PlantouBomba[playerid] = false;
    return 1;
}
Reply
#4

Quote:
Originally Posted by Joker_OutLock
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
    {
        if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
     }
        else
        {
            PlantouBomba[playerid] = false;
            return 1;
        }
    }
Quote:
Originally Posted by RoacH`
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
{
    if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
    PlantouBomba[playerid] = false;
    return 1;
}
Infelizmente nao deu nenhum :/
a bomba nao some e explodi :/
Reply
#5

pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
{
    if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
    DestroyObject(BombaRelogio[playerid]);
    SendClientMessage(playerid, -1, "Voce desarmou a bomba com sucesso!");
    PlantouBomba[playerid] = false;
    return 1;
}
Reply
#6

Simples, estб explodindo pois o Timer ainda estб rodando, use KillTimer no comando.

pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
{
    if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
    DestroyObject(BombaRelogio[playerid]);
    SendClientMessage(playerid, -1, "Voce desarmou a bomba com sucesso!");
    PlantouBomba[playerid] = false;
    KillTimer(BombTime);
    return 1;
}
Reply
#7

Quote:
Originally Posted by KinX
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
{
    if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
    DestroyObject(BombaRelogio[playerid]);
    SendClientMessage(playerid, -1, "Voce desarmou a bomba com sucesso!");
    PlantouBomba[playerid] = false;
    return 1;
}
A bomba sumiu mas msm assim houve a explosao :/
Reply
#8

Usa o do Zbt que ta certinho
Reply
#9

Quote:
Originally Posted by zbt
Посмотреть сообщение
Simples, estб explodindo pois o Timer ainda estб rodando, use KillTimer no comando.

pawn Код:
if(strcmp(cmdtext, "/desarmas", true) == 0)
{
    if(PlantouBomba[playerid] == 0) return SendClientMessage(playerid, Amarelo, " Vocк nгo plantou uma bomba. ");
    DestroyObject(BombaRelogio[playerid]);
    SendClientMessage(playerid, -1, "Voce desarmou a bomba com sucesso!");
    PlantouBomba[playerid] = false;
    KillTimer(BombTime);
    return 1;
}
deu erro:
Код:
error 076: syntax error in the expression, or invalid function call
linha: 61
PHP код:
 KillTimer(BombTime); 
Reply
#10

use bombtime
pawn Код:
KillTimer(bombtime);
estбva pegando o nome do timer ao invйz da vбriavel , rs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)