[Ajuda] Callback sendo chamada 2 vezes.
#1

Nгo sei oque tб rolando.. jб fiz de tudo mas nгo consegui resolver.

As armas sempre vem com o dobro da muniзгo e a mensagem do ant spawnkill й enviada 2 vezes.

pawn Код:
public OnPlayerSpawn(playerid)
{
    AntiDeAMX();

        if(pTeam[playerid] == TIME_1) {
            GivePlayerWeapon(playerid,25,100);
            GivePlayerWeapon(playerid,31,120);
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,16,3);
        }
        else if(pTeam[playerid] == TIME_2) {
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,30,150);
            GivePlayerWeapon(playerid,24,100);
            GivePlayerWeapon(playerid,27,85);
        }
        else if(pTeam[playerid] == TIME_3) {
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,26,100);
            GivePlayerWeapon(playerid,14,1);
            GivePlayerWeapon(playerid,18,5);

        }
        else if(pTeam[playerid] == TIME_4) {
            GivePlayerWeapon(playerid,24,100);
            GivePlayerWeapon(playerid,31,120);
            GivePlayerWeapon(playerid,27,80);
            GivePlayerWeapon(playerid,16,3);
        }
    if(PlayerInfo[playerid][Spec] == 0) {
        gAntiSpawnKillTimer[playerid] = SetTimerEx("OnAntiSpawnKillExpire", ANIT_SPAWNKILL_TIME * 1000, false, "i", playerid);
        SetPlayerHealth(playerid, cellmax);
        SendClientMessage(playerid,cor_laranja,"Ant sk ativado!");
        SetPlayerChatBubble(playerid, "Protegido Anti-Spawnkill", -1, 25.0, ANIT_SPAWNKILL_TIME * 1000);//the label over head
    }
    return 1;
}
Reply
#2

Faca debug!

pawn Код:
//<?
public OnPlayerSpawn(playerid)
{
    AntiDeAMX();

        printf("after: %d", pTeam[playerid]);
        if(pTeam[playerid] == TIME_1) {
            GivePlayerWeapon(playerid,25,100);
            GivePlayerWeapon(playerid,31,120);
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,16,3);
        }
        else if(pTeam[playerid] == TIME_2) {
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,30,150);
            GivePlayerWeapon(playerid,24,100);
            GivePlayerWeapon(playerid,27,85);
        }
        else if(pTeam[playerid] == TIME_3) {
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,26,100);
            GivePlayerWeapon(playerid,14,1);
            GivePlayerWeapon(playerid,18,5);

        }
        else if(pTeam[playerid] == TIME_4) {
            GivePlayerWeapon(playerid,24,100);
            GivePlayerWeapon(playerid,31,120);
            GivePlayerWeapon(playerid,27,80);
            GivePlayerWeapon(playerid,16,3);
        }
    if(PlayerInfo[playerid][Spec] == 0) {
        //gAntiSpawnKillTimer[playerid] = SetTimerEx("OnAntiSpawnKillExpire", ANIT_SPAWNKILL_TIME * 1000, false, "i", playerid);
        SetPlayerHealth(playerid, cellmax);
        SendClientMessage(playerid,cor_laranja,"Ant sk ativado!");
        SetPlayerChatBubble(playerid, "Protegido Anti-Spawnkill", -1, 25.0, ANIT_SPAWNKILL_TIME * 1000);//the label over head
    }
    printf("before: %d", pTeam[playerid]);
    return 1;
}
Reply
#3

Quote:
Originally Posted by zSuYaNw
Посмотреть сообщение
Faca debug!

pawn Код:
//<?
public OnPlayerSpawn(playerid)
{
    AntiDeAMX();

        printf("after: %d", pTeam[playerid]);
        if(pTeam[playerid] == TIME_1) {
            GivePlayerWeapon(playerid,25,100);
            GivePlayerWeapon(playerid,31,120);
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,16,3);
        }
        else if(pTeam[playerid] == TIME_2) {
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,30,150);
            GivePlayerWeapon(playerid,24,100);
            GivePlayerWeapon(playerid,27,85);
        }
        else if(pTeam[playerid] == TIME_3) {
            GivePlayerWeapon(playerid,29,80);
            GivePlayerWeapon(playerid,26,100);
            GivePlayerWeapon(playerid,14,1);
            GivePlayerWeapon(playerid,18,5);

        }
        else if(pTeam[playerid] == TIME_4) {
            GivePlayerWeapon(playerid,24,100);
            GivePlayerWeapon(playerid,31,120);
            GivePlayerWeapon(playerid,27,80);
            GivePlayerWeapon(playerid,16,3);
        }
    if(PlayerInfo[playerid][Spec] == 0) {
        //gAntiSpawnKillTimer[playerid] = SetTimerEx("OnAntiSpawnKillExpire", ANIT_SPAWNKILL_TIME * 1000, false, "i", playerid);
        SetPlayerHealth(playerid, cellmax);
        SendClientMessage(playerid,cor_laranja,"Ant sk ativado!");
        SetPlayerChatBubble(playerid, "Protegido Anti-Spawnkill", -1, 25.0, ANIT_SPAWNKILL_TIME * 1000);//the label over head
    }
    printf("before: %d", pTeam[playerid]);
    return 1;
}
[11:51:41] after: 1
[11:51:41] before: 1
[11:51:41] after: 1
[11:51:41] before: 1
Reply
#4

Algo esta chamando sua callback duas vezes..
Reply
#5

Quote:
Originally Posted by zSuYaNw
Посмотреть сообщение
Algo esta chamando sua callback duas vezes..
Sim.. e preciso descobrir oque й mas nгo faзo a mнnima ideia.
Reply
#6

Procura por :

pawn Код:
SpawnPlayer(playerid);
pode estб em alguma funзгo, fazendo com que й executada e repetindo 2 vezez.
Reply
#7

Quote:
Originally Posted by Jimmmy
Посмотреть сообщение
Procura por :

pawn Код:
SpawnPlayer(playerid);
pode estб em alguma funзгo, fazendo com que й executada e repetindo 2 vezez.
Jб procurei por isso mais os que estгo em uso nenhum faz conflito..
Reply
#8

Faзa um teste, veja se vai fucionar..

PHP код:
public OnPlayerSpawn(playerid)
{
    
AntiDeAMX();
    if(
pTeam[playerid] == TIME_1)
    {
        
GivePlayerWeapon(playerid,25,100);
        
GivePlayerWeapon(playerid,31,120);
        
GivePlayerWeapon(playerid,29,80);
        
GivePlayerWeapon(playerid,16,3);
        return 
1;
    }
    else if(
pTeam[playerid] == TIME_2)
    {
        
GivePlayerWeapon(playerid,29,80);
        
GivePlayerWeapon(playerid,30,150);
        
GivePlayerWeapon(playerid,24,100);
        
GivePlayerWeapon(playerid,27,85);
        return 
1;
    }
    else if(
pTeam[playerid] == TIME_3)
    {
        
GivePlayerWeapon(playerid,29,80);
        
GivePlayerWeapon(playerid,26,100);
        
GivePlayerWeapon(playerid,14,1);
        
GivePlayerWeapon(playerid,18,5);
        return 
1;
    }
    else if(
pTeam[playerid] == TIME_4)
    {
        
GivePlayerWeapon(playerid,24,100);
        
GivePlayerWeapon(playerid,31,120);
        
GivePlayerWeapon(playerid,27,80);
        
GivePlayerWeapon(playerid,16,3);
        return 
1;
    }
    if(
PlayerInfo[playerid][Spec] == 0)
    {
        
gAntiSpawnKillTimer[playerid] = SetTimerEx("OnAntiSpawnKillExpire"ANIT_SPAWNKILL_TIME 1000false"i"playerid);
        
SetPlayerHealth(playeridcellmax);
        
SendClientMessage(playerid,cor_laranja,"Ant sk ativado!");
        
SetPlayerChatBubble(playerid"Protegido Anti-Spawnkill", -125.0ANIT_SPAWNKILL_TIME 1000);//the label over head
        
return 1;
    }
    return 
1;

Reply
#9

Quote:
Originally Posted by Jimmmy
Посмотреть сообщение
Faзa um teste, veja se vai fucionar..

PHP код:
public OnPlayerSpawn(playerid)
{
    
AntiDeAMX();
    if(
pTeam[playerid] == TIME_1)
    {
        
GivePlayerWeapon(playerid,25,100);
        
GivePlayerWeapon(playerid,31,120);
        
GivePlayerWeapon(playerid,29,80);
        
GivePlayerWeapon(playerid,16,3);
        return 
1;
    }
    else if(
pTeam[playerid] == TIME_2)
    {
        
GivePlayerWeapon(playerid,29,80);
        
GivePlayerWeapon(playerid,30,150);
        
GivePlayerWeapon(playerid,24,100);
        
GivePlayerWeapon(playerid,27,85);
        return 
1;
    }
    else if(
pTeam[playerid] == TIME_3)
    {
        
GivePlayerWeapon(playerid,29,80);
        
GivePlayerWeapon(playerid,26,100);
        
GivePlayerWeapon(playerid,14,1);
        
GivePlayerWeapon(playerid,18,5);
        return 
1;
    }
    else if(
pTeam[playerid] == TIME_4)
    {
        
GivePlayerWeapon(playerid,24,100);
        
GivePlayerWeapon(playerid,31,120);
        
GivePlayerWeapon(playerid,27,80);
        
GivePlayerWeapon(playerid,16,3);
        return 
1;
    }
    if(
PlayerInfo[playerid][Spec] == 0)
    {
        
gAntiSpawnKillTimer[playerid] = SetTimerEx("OnAntiSpawnKillExpire"ANIT_SPAWNKILL_TIME 1000false"i"playerid);
        
SetPlayerHealth(playeridcellmax);
        
SendClientMessage(playerid,cor_laranja,"Ant sk ativado!");
        
SetPlayerChatBubble(playerid"Protegido Anti-Spawnkill", -125.0ANIT_SPAWNKILL_TIME 1000);//the label over head
        
return 1;
    }
    return 
1;

Sem resultados.
Reply
#10

tente:

pawn Код:
public OnPlayerSpawn(playerid)
{
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)