[AJUDA] /bomba
#1

Galera, to montando um sistema de Bomba que explode com Detonador...
E to meio enrrolado numa coisa aqui:

Este й o code Inteiro:
pawn Код:
// TOPO
new Bomba[MAX_PLAYER] = -2;
//OnCommandText
     if(strcmp(cmdtext, "/comprarbomba", true) == 0)
{
    if(Bomba[playerid] != -2) return SendClientMessage(playerid, AMARELO_ATENCAO, "Vocк jб tem uma bomba. ( /plantarbomba )");
    Bomba[playerid] = -1
    SendClientMessage(playerid, -1, "Vocк comprou uma bomba e isso lhe custou 1000");    
    GameTextForPlayer(playerid, "~w~/plantar~r~bomba~w~ !!", 3000, 5);
    GivePlayerMoney(playerid, -10000);
    return 1;
}

    if(strcmp(cmdtext, "/plantarbomba", true) == 0)
{
    new Float:bx, Float: by, Float: bz
    if(Bomba[playerid] != -1) return SendClientMessage(playerid, -1, "Vocк nгo tem uma bomba. /Comprarbomba");
    GetPlayerPos(playerid, bx, by, bz);
    SendClientMessage(playerid, AMARELO_ATENCAO, "Bomba Plaatada com Sucesso. /edetonarbomba para Detona-la");
    Bomba[playerid] = CreateObject(1654, bx+1, by, bz-0.8, 0, 0, 0);
    return 1;
}
    if(strcmp(cmdtext, "/detonar", true) == 0)
    SetTimerEx("Detonar", 6000, false, "ffbbb", playerid, Bomba[playerid]);
    Bomba[playerid] = -2;
    GameTextForPlayer(playerid, "5", 1000, 6);    
    GameTextForPlayer(playerid, "4", 1000, 6);        
    GameTextForPlayer(playerid, "3", 1000, 6);            
    GameTextForPlayer(playerid, "2", 1000, 6);                
    GameTextForPlayer(playerid, "1", 1000, 6);    
    return 1;    
}
    // FIM DO MODE.
    forward Detonar(pID, bomba, Float:x, Float:y, Float:z);
    public Detonar(pID, bomba, Float:x, Float:y, Float:z)
{
    DestroyObject(bomba);
    CreateExplosion(x, y, z, 10, 2000);
    CreateExplosion(x+2, y+2, z+2, 10, 2000);
    CreateExplosion(x+3, y+3, z+3, 10, 2000);
    GameTextForPlayer(pID,"~r~Bomba~w~ detonada com sucesso.", 3000, 5);
    return 1;
}
Porem eu recebo Varios Erros e Warnings. Mais, por ventura, NENHUM deles estб nas linhas do codigo O.o
Vejam os Erros e Warnings:
Код:
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(241) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(244) : error 021: symbol already defined: "GetPlayerPos"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(250) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(252) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(255) : error 021: symbol already defined: "GetPlayerPos"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(257) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(259) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(267) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(269) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(272) : error 021: symbol already defined: "GetPlayerPos"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(274) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(277) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(281) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(283) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(286) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(291) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(294) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(298) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(301) : error 010: invalid function or declaration
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(343) : warning 219: local variable "x" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(343) : warning 219: local variable "y" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(385) : warning 219: local variable "x" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(385) : warning 219: local variable "y" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(385) : warning 219: local variable "z" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103) : warning 204: symbol is assigned a value that is never used: "ArenaDM"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "X"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "Y"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "Z"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "slx"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "sly"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "slz"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "x"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: 
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "y"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "z"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "zlx"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "zly"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(103 -- 395) : warning 203: symbol is never used: "zlz"
Repitindo, NENHUM dos Erros e Warnings acima estгo nas linhas do Sistema de Bombas...
Porem, se eu retirar a funзгo:
pawn Код:
if(strcmp(cmdtext, "/detonar", true) == 0)
    SetTimerEx("Detonar", 6000, false, "ffbbb", playerid, Bomba[playerid]);
    Bomba[playerid] = -2;
    GameTextForPlayer(playerid, "5", 1000, 6);    
    GameTextForPlayer(playerid, "4", 1000, 6);        
    GameTextForPlayer(playerid, "3", 1000, 6);            
    GameTextForPlayer(playerid, "2", 1000, 6);                
    GameTextForPlayer(playerid, "1", 1000, 6);    
    return 1;    
}
Eu consigo copilar sem erros, comprar e plantar minhas bombas, mais obviamente claro que nao conssigo detonalas.
Aonde estou errando ? HEEELP, /To quase com 50Posts *-*
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/detonar", true) == 0)
{
    SetTimerEx("Detonar", 6000, false, "ffbbb", playerid, Bomba[playerid]);
    Bomba[playerid] = -2;
    GameTextForPlayer(playerid, "5", 1000, 6);    
    GameTextForPlayer(playerid, "4", 1000, 6);        
    GameTextForPlayer(playerid, "3", 1000, 6);            
    GameTextForPlayer(playerid, "2", 1000, 6);                
    GameTextForPlayer(playerid, "1", 1000, 6);    
    return 1;    
}
faltava vocк abrir as chaves.
Reply
#3

LOL que Fail...
Brigado Caroline +REP

@EDIT
Perae Problemas aqui:

Quando digito /detonar, ao final do Settime a bomba nao explode O.o
Ela apenas й destroi a bomba mais nao executa o CreateExplosion
Ajuda ? e.e
Reply
#4

pawn Код:
new bool:Bomba[MAX_PLAYERS] = false;
new Float:bx[MAX_PLAYERS], Float: by[MAX_PLAYERS], Float: bz[MAX_PLAYERS];
new bomba[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/comprarbomba", true))
    {
        if(Bomba[playerid] == true)
            return SendClientMessage(playerid, AMARELO_ATENCAO, "Vocк jб tem uma bomba. ( /plantarbomba )");
           
        Bomba[playerid] = false;
        SendClientMessage(playerid, -1, "Vocк comprou uma bomba e isso lhe custou 1000");
        GameTextForPlayer(playerid, "~w~/plantar~r~bomba~w~ !!", 3000, 5);
        GivePlayerMoney(playerid, -10000);
        return 1;
    }

    if(!strcmp(cmdtext, "/plantarbomba", true))
    {
        if(Bomba[playerid] == false)
            return SendClientMessage(playerid, -1, "Vocк nгo tem uma bomba. /Comprarbomba");
           
        GetPlayerPos(playerid, bx[playerid], by[playerid], bz[playerid]);
        SendClientMessage(playerid, AMARELO_ATENCAO, "Bomba Plaatada com Sucesso. /edetonarbomba para Detona-la");
        bomba[playerid] = CreateObject(1654, bx[playerid]+1, by[playerid], bz[playerid]-0.8, 0.0, 0.0, 0.0, 100);
        return 1;
    }
    if(!strcmp(cmdtext, "/detonar", true))
    {
        SetTimerEx("Detonar", 6000, false, "ffbbb", playerid, bomba[playerid], bx[playerid], by[playerid], bz[playerid]);
        Bomba[playerid] = false;
        GameTextForPlayer(playerid, "5", 1000, 6);
        GameTextForPlayer(playerid, "4", 1000, 6);
        GameTextForPlayer(playerid, "3", 1000, 6);
        GameTextForPlayer(playerid, "2", 1000, 6);
        GameTextForPlayer(playerid, "1", 1000, 6);
        return 1;
    }
    return 0;
}

stock Detonar(pID, b, Float:x, Float:y, Float:z)
{
    DestroyObject(b);
    CreateExplosion(x, y, z, 10, 2000);
    CreateExplosion(x+2, y+2, z+2, 10, 2000);
    CreateExplosion(x+3, y+3, z+3, 10, 2000);
    GameTextForPlayer(pID,"~r~Bomba~w~ detonada com sucesso.", 3000, 5);
    return 1;
}
Reply
#5

Plantarbomba:
pawn Код:
if(!strcmp(cmdtext, "/plantarbomba", true))
{  
    if(Bomba[playerid] == true)
    return SendClientMessage(playerid, -1, "Vocк nгo tem uma bomba. /Comprarbomba");
    Bomba[playerid] == false;
    GetPlayerPos(playerid, bx[playerid], by[playerid], bz[playerid]);
    SendClientMessage(playerid, AMARELO_ATENCAO, "Bomba Plantada com Sucesso. /edetonarbomba para Detona-la");    
    bomba[playerid] = CreateObject(1654, bx[playerid]+1, by[playerid], bz[playerid]-0.8, 0.0, 0.0, 0.0, 100);        
    return 1;
}
JA ESTБ ARRUMADO !!
Reply
#6

Muda essa parte aqui


pawn Код:
if(!strcmp(cmdtext, "/comprarbomba", true))
    {
        if(Bomba[playerid] == true)
            return SendClientMessage(playerid, AMARELO_ATENCAO, "Vocк jб tem uma bomba. ( /plantarbomba )");
           
        Bomba[playerid] = true; //ele estava false ou seja daria pra comprar bombas infinitamente '-'
        SendClientMessage(playerid, -1, "Vocк comprou uma bomba e isso lhe custou 1000");
        GameTextForPlayer(playerid, "~w~/plantar~r~bomba~w~ !!", 3000, 5);
        GivePlayerMoney(playerid, -10000);
        return 1;
    }
Reply
#7

Ok Ok, ajustando o /comprarbomba, ja ajustei tambem o /plantarbomba...
Agora ainda existe um problema.
Na verdade dois...
1: O /Detonar nao funciona :S
/Detonar e nada acontece :S
Reply
#8

pawn Код:
if(!strcmp(cmdtext, "/detonar", true))
    {
        //SetTimerEx("Detonar", 6000, false, "ffbbb", playerid, bomba[playerid], bx[playerid], by[playerid], bz[playerid]);
        Bomba[playerid] = false;
        GameTextForPlayer(playerid, "5", 1000, 6);
        GameTextForPlayer(playerid, "4", 1000, 6);
        GameTextForPlayer(playerid, "3", 1000, 6);
        GameTextForPlayer(playerid, "2", 1000, 6);
        GameTextForPlayer(playerid, "1", 1000, 6);
        DestroyObject( bomba[playerid]);
        CreateExplosion(bx[playerid], by[playerid], bz[playerid], 10, 2000);
        CreateExplosion(bx[playerid]+2, by[playerid]+2, bz[playerid]+2, 10, 2000);
        CreateExplosion(bx[playerid]+3, by[playerid]+3, bz[playerid]+3, 10, 2000);
        GameTextForPlayer(pID,"~r~Bomba~w~ detonada com sucesso.", 3000, 5);
        return 1;
    }
Reply
#9

Tenta isso aqui


pawn Код:
if(!strcmp(cmdtext, "/detonar", true))
    {
        SetTimerEx("Detonar", 6000, false, "fffdd",x,y,z,10,2000);
        Bomba[playerid] = false;
        GameTextForPlayer(playerid, "5", 1000, 6);
        GameTextForPlayer(playerid, "4", 1000, 6);
        GameTextForPlayer(playerid, "3", 1000, 6);
        GameTextForPlayer(playerid, "2", 1000, 6);
        GameTextForPlayer(playerid, "1", 1000, 6);
        return 1;
    }
Reply
#10

Consegui \х
Fiz assim:
pawn Код:
// TOPO
new bool:Bomba[MAX_PLAYERS] = false;
new Float:bx[MAX_PLAYERS], Float: by[MAX_PLAYERS], Float: bz[MAX_PLAYERS];
new bomba[MAX_PLAYERS];
// OnCommandText
    if(!strcmp(cmdtext, "/comprarbomba", true))
{
    if(Bomba[playerid] == true)
    return SendClientMessage(playerid, AMARELO_ATENCAO, "Vocк jб tem uma bomba. ( /plantarbomba )");
    Bomba[playerid] = true;
    SendClientMessage(playerid, -1, "Vocк comprou uma bomba e isso lhe custou 1000");
    GameTextForPlayer(playerid, "~w~/plantar~r~bomba~w~ !!", 3000, 5);
    GivePlayerMoney(playerid, -10000);
    return 1;
}
    if(!strcmp(cmdtext, "/plantarbomba", true))
{  
    if(Bomba[playerid] == false)
    return SendClientMessage(playerid, -1, "Vocк nгo tem uma bomba. /Comprarbomba");
    Bomba[playerid] = false;
    GetPlayerPos(playerid, bx[playerid], by[playerid], bz[playerid]);
    SendClientMessage(playerid, AMARELO_ATENCAO, "Bomba Plantada com Sucesso. /detonar para Detona-la");    
    bomba[playerid] = CreateObject(1654, bx[playerid]+1, by[playerid], bz[playerid]-0.8, 0.0, 0.0, 0.0, 100);        
    return 1;
}
    if(!strcmp(cmdtext, "/detonar", true))
{
    if(Bomba[playerid] == true)
    return SendClientMessage(playerid, -1, "Vocк nгo tem uma bomba. /Comprarbomba");
    Bomba[playerid] = true;
    DestroyObject( bomba[playerid]);
    CreateExplosion(bx[playerid], by[playerid], bz[playerid], 10, 2000);
    CreateExplosion(bx[playerid]+2, by[playerid]+2, bz[playerid]+2, 10, 2000);
    CreateExplosion(bx[playerid]+3, by[playerid]+3, bz[playerid]+3, 10, 2000);
    GameTextForPlayer(playerid,"~r~Bomba~w~ detonada com sucesso.", 3000, 5);
    return 1;
    }    
    return 0;
}
Funcionando perfeitamente.
> N da pra comprar 2 Bombas.
> N da pra Plantar 2 Bombas.
> N da pra Detonar 2 Bombas
> N da pra Detonar sem ter bombas.

Brigado Niiw e Caroline.
Ja adicionei a Rep do Niiw, e Caroline, pq eu n consigo te dar Rep ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)