[AJUDA] Problema com bomba
#1

Galera eu saquei um GM, fui testar e quando vc esta em um aviгo e carrega CTRL direito larga uma bomba, sу que da Bug

Ou explode muito tarde, ou Explode mal eu carrego CTRL, por favor podem reparar isso?

Esta aqui o Codigo:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			new key, updown, leftright;
			GetPlayerKeys(i, key, updown, leftright);
			printf("%d",key);

			if(key == 140)
			{
				if(GetVehicleModel(GetPlayerVehicleID(i)) == 476)
				{
					new bombaid;
					new Float:X,Float:Y,Float:Z,Float:a;
					GetPlayerPos(i,X,Y,Z);
					SetPlayerFacingAngle(i,a);
					bombaid = CreateObject(354,X,Y,Z,0,0,a);
					new ddb = 10;
					MoveObject(bombaid,X,Y,Z-ddb,1);
					new ddb2=ddb*1000;
					SetTimerEx("explodirBomba",ddb2,false,"dfff",bombaid);
				}
			}
		}
	}
}
public explodirBomba(bombaid2)
{
	new Float:X,Float:Y,Float:Z;
	GetObjectPos(bombaid2,X,Y,Z);
	CreateExplosion(X,Y,Z, 6, 20.0);
	CreateExplosion(X+1,Y-1,Z, 6, 20.0);
	CreateExplosion(X-1,Y+1,Z, 6, 20.0);
	CreateExplosion(X+1,Y+1,Z, 6, 20.0);
	CreateExplosion(X-1,Y-1,Z, 6, 20.0);
	DestroyObject(bombaid2);
	return 1;
}
Desde ja agradeзo
Reply
#2

tente assim
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
            new key, updown, leftright;
            GetPlayerKeys(i, key, updown, leftright);
            printf("%d",key);

            if(key == 140)
            {
                if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
                {
                    new bombaid;
                    new Float:X,Float:Y,Float:Z,Float:a;
                    GetPlayerPos(playerid,X,Y,Z);
                    SetPlayerFacingAngle(playerid,a);
                    bombaid = CreateObject(354,X,Y,Z,0,0,a);
                    new ddb = 10;
                    MoveObject(bombaid,X,Y,Z-ddb,1);
                    new ddb2=ddb*1000;
                    SetTimerEx("explodirBomba",ddb2,false,"dfff",bombaid);
                }
            }
        }
Reply
#3

quando compilei deu erro

Код:
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(26) : error 029: invalid expression, assumed zero
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(26) : error 008: must be a constant expression; assumed zero
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(252) : error 017: undefined symbol "i"
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(271) : error 054: unmatched closing brace ("}")
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(113) : warning 204: symbol is assigned a value that is never used: "Aliado"
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(114) : warning 204: symbol is assigned a value that is never used: "Nazista"
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ENBWW.pwn(114 -- 303) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#4

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
            new key, updown, leftright;
            GetPlayerKeys(playerid, key, updown, leftright);
            printf("%d",key);

            if(key == 140)
            {
                if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
                {
                    new bombaid;
                    new Float:X,Float:Y,Float:Z,Float:a;
                    GetPlayerPos(playerid,X,Y,Z);
                    SetPlayerFacingAngle(playerid,a);
                    bombaid = CreateObject(354,X,Y,Z,0,0,a);
                    new ddb = 10;
                    MoveObject(bombaid,X,Y,Z-ddb,1);
                    new ddb2=ddb*1000;
                    SetTimerEx("explodirBomba",ddb2,false,"dfff",bombaid);
                }
            }
        }
erro meu, ainda deixei um i
Reply
#5

Entao, gostei do code e adaptei ele pra um cmd, so que quando uso crasha o servidor... alguem sabe o porque? obg
pawn Код:
if(strcmp(cmd, "/BombaR", true) == 0)
    {
                    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
                {
                    new bombaid;
                    new Float:X,Float:Y,Float:Z;
                    GetPlayerPos(playerid,X,Y,Z);
                    bombaid = CreateObject(354,X,Y,Z,0,0,0);
                    new ddb = 10;
                    MoveObject(bombaid,X,Y,Z-ddb,1);
                    new ddb2=ddb*1000;
                    SetTimerEx("explodirBomba",ddb2,false,"dfff",bombaid);
                }
                    return 1;
    }
Reply
#6

Quote:
Originally Posted by lukas_loky
Посмотреть сообщение
Entao, gostei do code e adaptei ele pra um cmd, so que quando uso crasha o servidor... alguem sabe o porque? obg
pawn Код:
if(strcmp(cmd, "/BombaR", true) == 0)
    {
                    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
                {
                    new bombaid;
                    new Float:X,Float:Y,Float:Z;
                    GetPlayerPos(playerid,X,Y,Z);
                    bombaid = CreateObject(354,X,Y,Z,0,0,0);
                    new ddb = 10;
                    MoveObject(bombaid,X,Y,Z-ddb,1);
                    new ddb2=ddb*1000;
                    SetTimerEx("explodirBomba",ddb2,false,"d",bombaid);
                }
                    return 1;
    }

Isto deve resolver o seu problema

pawn Код:
if(strcmp("/bombar",cmdtext,true,7)==0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
        {
            new bombaid;
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            bombaid = CreateObject(354,X,Y,Z,0,0,0);
            new ddb = 10;
            MoveObject(bombaid,X,Y,Z-ddb,1);
            new ddb2=ddb*1000;
            SetTimerEx("explodirBomba",ddb2,false,"d",bombaid);
        }
        return 1;
    }
   
   

//E coloque no Final do GM:

forward explodirBomba(bombaid);
public explodirBomba(bombaid)
{
    new Float:X,Float:Y,Float:Z;
    GetObjectPos(bombaid,X,Y,Z);
    CreateExplosion(X,Y,Z, 6, 20.0);
    CreateExplosion(X+1,Y-1,Z, 6, 20.0);
    CreateExplosion(X-1,Y+1,Z, 6, 20.0);
    CreateExplosion(X+1,Y+1,Z, 6, 20.0);
    CreateExplosion(X-1,Y-1,Z, 6, 20.0);
    DestroyObject(bombaid);
    return 1;
}
Espero ter ajudado
Reply
#7

ja tinha isso no final... =)
Reply
#8

Ok Vou Exprimentar Muito Obrigado :P
Reply
#9

Deu Outros Erros =S

Код:
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ZO-RP(3teste).pwn(906) : warning 219: local variable "X" shadows a variable at a preceding level
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ZO-RP(3teste).pwn(906) : warning 219: local variable "Y" shadows a variable at a preceding level
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ZO-RP(3teste).pwn(906) : warning 219: local variable "Z" shadows a variable at a preceding level
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ZO-RP(3teste).pwn(1320) : warning 219: local variable "X" shadows a variable at a preceding level
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ZO-RP(3teste).pwn(1320) : warning 219: local variable "Y" shadows a variable at a preceding level
C:\Users\Gonзalo.utilizador-PC\Desktop\SAMP - TPD\gamemodes\ZO-RP(3teste).pwn(1320) : warning 219: local variable "Z" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Warnings.
Reply
#10

Acho que devera retirar essa linha

pawn Код:
new Float:X,Float:Y,Float:Z;
ela ja foi usada a um nivel anterior
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)