[Ajuda] Bug Intro
#1

Pessoal, fiz uma intro para meu servidor, o problema й que quando uma outra pessoa loga... a pessoa que jб estб Spawnada vк a intro e a intro trava pra pessoa que estava comeзando a ver, como se estivesse global. Como eu posso resolver isso? cуdigo:

PHP код:
new NumeroIntro[MAX_PLAYERS];
new 
AutoIntro[MAX_PLAYERS];
new 
PlayerText:textIntro[11][MAX_PLAYERS];
static
    
PlayerText:FADE_BOX[MAX_PLAYERS],
    
FADE_STATUS 0x01,
    
FADE_TIMER[MAX_PLAYERS]
;
public 
OnPlayerConnect(playerid)
{
    
AutoIntro[playerid] = 0;
    return 
1;
}
stock CarregarPlayer(playerid)
{
    new 
Arquivo[40];
    
format(Arquivosizeof(Arquivo), "Contas/%s.ini"PlayerName(playerid));
    if(
DOF2_FileExists(Arquivo))
    {
        
PlayerInfo[playerid][pLevel] = DOF2_GetInt(Arquivo"Level");
        
ResetPlayerMoney(playerid);
        
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]);
        
DOF2_SaveFile();
    }
    
ResetPlayerMoney(playerid);
    
hideTelaLogin(playerid);
    
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]);
    
//GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
    
gPlayerLogged[playerid] = 1;
    if(
PlayerInfo[playerid][pReg] == 0)
    {
        
InterpolateCameraPos(playerid, -1473.536987929.03411827.499238, -1473.536987929.03411827.4992384000);
        
InterpolateCameraLookAt(playerid, -1468.784301927.62591526.844387, -1468.784301927.62591526.8443874000);
        
// AQUI ELE CHAMA UMA TEXTDRAW E QUANDO CLICAR NELA VAI PRO TUTORIAL.. CУDIGO NO OnPlayerClickTextDraw
    
}
    else
    {
         
AutoIntro[playerid] = 0;
        
NumeroIntro[playerid] = 5;
        
FADE_TIMER[playerid] = SetTimerEx("FadeEffect"FADE_VELOCITYtrue"i"playerid);
        
PlayerTextDrawShow(playeridFADE_BOX[playerid]);
    }
    return 
1;
}
stock Intro(playerid)
{
    
NumeroIntro[playerid] ++;
    new 
numero NumeroIntro[playerid];
    
ClearChatbox(playerid20);
    switch(
numero){
        case 
1:
        {
            
StopAudioStreamForPlayer(playerid);
            
PlayAudioStreamForPlayer(playerid"https://dl.dropboxusercontent.com/s/m5w2f6olrnmaxrv/Soundtrack%20-%20Intro.mp3?dl=0");
            
ClearChatbox(playerid20);
            
PlayerTextDrawShow(playeridtextIntro[0][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[1][playerid]);
            
InterpolateCameraPos(playerid, -1585.274414904.30200132.613651, -1528.172241915.25054924.12478410000);
            
InterpolateCameraLookAt(playerid, -1580.596313905.56622331.382064, -1523.501464916.33966022.71152610000);
            
SetTimer("LoadFadeEffect"5000false);
        }
        case 
2:
        {
            
PlayerTextDrawHide(playeridtextIntro[0][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[1][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[2][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[3][playerid]);
            
InterpolateCameraPos(playerid, -1437.165161999.10351535.027973, -1498.252075966.62829535.0279739000);
            
InterpolateCameraLookAt(playerid, -1434.941528994.78039533.859199, -1495.894287962.35443133.9441149000);
            
SetTimer("LoadFadeEffect"5000false);
        }
        case 
3:
        {
            
PlayerTextDrawHide(playeridtextIntro[0][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[1][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[2][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[3][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[4][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[5][playerid]);
            
InterpolateCameraPos(playerid, -1487.162841919.10321014.610277, -1461.596923920.93347114.8774319000);
            
InterpolateCameraLookAt(playerid, -1484.466308923.26678413.983280, -1456.598999921.00396715.0041379000);
            
SetTimer("LoadFadeEffect"5000false);
        }
        case 
4:
        {
            
PlayerTextDrawHide(playeridtextIntro[0][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[1][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[2][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[3][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[4][playerid]);
            
PlayerTextDrawHide(playeridtextIntro[5][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[6][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[7][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[8][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[9][playerid]);
            
PlayerTextDrawShow(playeridtextIntro[10][playerid]);
            
InterpolateCameraPos(playerid, -1451.406494916.08038316.590414, -1452.305053915.99432326.9026569000);
            
InterpolateCameraLookAt(playerid, -1446.423706915.94787516.198200, -1447.309570916.00665226.6901479000);
            
SetTimer("LoadFadeEffect"5000false);
        }
        default:{
            
GameTextForPlayer(playerid"~w~~y~Bem-vindo a ~n~ BullWorth"10001);
            
NumeroIntro[playerid] = 0;
            
AutoIntro[playerid] = 0;
            
TogglePlayerSpectating(playerid0);
            
CancelSelectTextDraw(playerid);
            
SetPlayerPos(playerid, -1501.2959920.44867.2524);
            
SetPlayerFacingAngle(playerid269.8085);
            if(
PlayerInfo[playerid][pSex] == 1)
                
SetPlayerSkin(playerid121);
            if(
PlayerInfo[playerid][pSex] == 2)
                
SetPlayerSkin(playerid190);
            for(new 
x!= 36x++){
            
PlayerTextDrawShow(playeridTextProgressBar[x][playerid]);}
            for(new 
x!= 5x++){
            
TextDrawShowForPlayer(playeridtextRodape[x]);}
            
StopAudioStreamForPlayer(playerid);
            
PlayAudioStreamForPlayer(playerid"https://dl.dropboxusercontent.com/s/v9ndl3fvawwt4li/Sound-Bully.mp3?dl=0");
            
ClearChatbox(playerid20);
        }
    }
    return 
1;
}
public 
OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(
clickedid == sexo_draw[12])
    {
        
PlayerInfo[playerid][pSex] = 1;
        
AutoIntro[playerid] = 1;
        
NumeroIntro[playerid] = 0;
        for(new 
x!= 14x++) TextDrawHideForPlayer(playeridsexo_draw[x]);
        
CancelSelectTextDraw(playerid);
        
FADE_TIMER[playerid] = SetTimerEx("FadeEffect"FADE_VELOCITYtrue"i"playerid);
        
PlayerTextDrawShow(playeridFADE_BOX[playerid]);
    }
    if(
clickedid == sexo_draw[13])
    {
        
PlayerInfo[playerid][pSex] = 2;
        
AutoIntro[playerid] = 1;
        
NumeroIntro[playerid] = 0;
        for(new 
x!= 14x++) TextDrawHideForPlayer(playeridsexo_draw[x]);
        
CancelSelectTextDraw(playerid);
        
FADE_TIMER[playerid] = SetTimerEx("FadeEffect"FADE_VELOCITYtrue"i"playerid);
        
PlayerTextDrawShow(playeridFADE_BOX[playerid]);
    }
    return 
1;
}
public 
FadeEffect(playerid)
{
    
PlayerTextDrawBoxColor(playeridFADE_BOX[playerid], (FADE_STATUS = (FADE_STATUS 0x01)));
    
PlayerTextDrawShow(playeridFADE_BOX[playerid]);
    if(
FADE_STATUS == 0xFF)
    {
        
FADE_STATUS 0x01;
        
KillTimer(FADE_TIMER[playerid]);
         
PlayerTextDrawHide(playeridFADE_BOX[playerid]);
         if(
AutoIntro[playerid] == 1Intro(playerid);
    }
    return 
1;
}
public 
LoadFadeEffect(playerid)
{
     for(new 
x!= 11x++){
    
PlayerTextDrawHide(playeridtextIntro[x][playerid]);}
    
FADE_TIMER[playerid] = SetTimerEx("FadeEffect"FADE_VELOCITYtrue"i"playerid);
    
PlayerTextDrawShow(playeridFADE_BOX[playerid]);
    return 
1;

Reply
#2

Alguйm ajuda pfv
Reply
#3

Tem uns:
PHP код:
SetTimer("LoadFadeEffect"5000false); 
troque por
PHP код:
SetTimerEx("LoadFadeEffect"5000false"i"playerid); 
Reply
#4

Deu certo '-' pode me explicar por que:
Quote:

SetTimer("LoadFadeEffect", 5000, false);

Nгo funciona e:
Quote:

SetTimerEx("LoadFadeEffect", 5000, false, "i", playerid);

funciona?
Reply
#5

SetTimer = sem parвmetro
SetTimerEx = com parвmetro

Sua callback LoadFadeEffect possui um parвmetro (playerid) cujo valor sempre serб 0, pois quando ela й chamada pelo SetTimer nгo hб valores definidos para playerid, logo somente o jogador ID 0 vai ver a intro.
Reply
#6

Caramba.. vlw
Reply
#7

https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)