[Ajuda] erro com id 0 !
#1

Bom galera estou tendo dificuldades com o server tem um bug que cada vez quer a pessoa logar puxar o

id 0 para o local de spawn, isto sу acontecer com o id 0 serб que uma Loop ?.

sу que eu nгo tenho a menor ideia do que pode ser alguйm da uma opiniгo sobre o assunto ??
Reply
#2

Pode passar o cуdigo de quando o cara loga ou spawna ?
Reply
#3

pawn Код:
if(dialogid == cidades)
    {
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, sizeof(aname));
        format(file, sizeof(file), PASTA_CONTAS, aname);
        if(dini_Int(file, "novato") == 1)
        {
            format(STRX, sizeof(STRX), "{00FF00}-| {FFFFFF}%s\n\n {FF0000}Atenзгo: %s\n{00FF00}Logue-se, digite sua senha:", aname);
        }
        if(response == 1)
        {
            if(listitem == 0)                                                                      // Los Santos
            {
                dini_FloatSet(file, "CasaX", Float:1653.9580);
                dini_FloatSet(file, "CasaY", Float:-1657.6052);
                dini_FloatSet(file, "CasaZ", Float:22.6548);
                if(dini_Int(file, "novato") == 1)
                {
                    ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", STRX, "Logar", "Sair");
                }
                if(IsPlayerInDynamicCP(playerid, CheckpointsFix[29]))
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, 1653.9580, -1657.6052, 22.6548);
                }
                SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 357.9491, 0, 0, 0, 0, 0, 0);
            }
            if(listitem == 1)                                                                      // San Fierro
            {
                dini_FloatSet(file, "CasaX", Float:-2706.2280);
                dini_FloatSet(file, "CasaY", Float:387.5801);
                dini_FloatSet(file, "CasaZ", Float:4.3749);
                if(dini_Int(file, "novato") == 1)
                {
                    ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", STRX, "Logar", "Sair");
                }
                if(IsPlayerInDynamicCP(playerid, CheckpointsFix[29]))
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, -2706.2280, 387.5801, 4.3749);
                }
                SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 270.6406, 0, 0, 0, 0, 0, 0);
            }
            if(listitem == 2)                                                                      // Las Venturas
            {
                dini_FloatSet(file, "CasaX", Float:2330.1411);
                dini_FloatSet(file, "CasaY", Float:2352.7380);
                dini_FloatSet(file, "CasaZ", Float:10.8203);
                if(dini_Int(file, "novato") == 1)
                {
                    ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", STRX, "Logar", "Sair");
                }
                if(IsPlayerInDynamicCP(playerid, CheckpointsFix[29]))
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, 2330.1411, 2352.7380, 10.8203);
                }
                SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 270.6406, 0, 0, 0, 0, 0, 0);
            }
            if(listitem == 3)                                                                      // Forte Carson
            {
                dini_FloatSet(file, "CasaX", Float:-89.4515);
                dini_FloatSet(file, "CasaY", Float:1223.6799);
                dini_FloatSet(file, "CasaZ", Float:19.7422);
                if(dini_Int(file, "novato") == 1)
                {
                    ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", STRX, "Logar", "Sair");
                }
                if(IsPlayerInDynamicCP(playerid, CheckpointsFix[29]))
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, -89.4515, 1223.6799, 19.7422);
                }
                SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 181.3490, 0, 0, 0, 0, 0, 0);
            }
        }
        return 1;
    }
Reply
#4

Posta a callback OnPlayerSpawn completa.
Reply
#5

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    new pname[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, pname);

    TextDrawHideForPlayer(playerid,Area);
    TextDrawHideForPlayer(playerid,Area1);
    TextDrawHideForPlayer(playerid,Area2);
    TextDrawHideForPlayer(playerid,Area3);
    TextDrawHideForPlayer(playerid,Area4);
    TextDrawHideForPlayer(playerid,AreaMotd);

    // ================================ Anim Loops =====================================
    #if defined AnimLoopsUser
    if(!gPlayerAnimLibsPreloaded[playerid])
    {
        PreloadAnimLib(playerid, "COP_AMBIENT");
        PreloadAnimLib(playerid, "ON_LOOKERS");
        PreloadAnimLib(playerid, "benchpress");
        PreloadAnimLib(playerid, "RAPPING");
        PreloadAnimLib(playerid, "SMOKING");
        PreloadAnimLib(playerid, "DEALER");
        PreloadAnimLib(playerid, "BOMBER");
        PreloadAnimLib(playerid, "MD_END");
        PreloadAnimLib(playerid, "FINALE");
        PreloadAnimLib(playerid, "BEACH");
        PreloadAnimLib(playerid, "SWEET");
        PreloadAnimLib(playerid, "STRIP");
        PreloadAnimLib(playerid, "CARRY");
        PreloadAnimLib(playerid, "CRACK");
        PreloadAnimLib(playerid, "SHOP");
        PreloadAnimLib(playerid, "FOOD");
        PreloadAnimLib(playerid, "PARK");
        PreloadAnimLib(playerid, "PED");
        PreloadAnimLib(playerid, "BAR");

        gPlayerAnimLibsPreloaded[playerid] = 1;
        printf("Os animes foram prй carregados para %s.", pname);
    }
    #endif
    // =================================================================================

    if(cercado[playerid] == 1)
    {
        cercado[playerid] = 0;
        UncagePlayer(playerid);
    }

    emcasa[playerid] = 0;
    autoescola[playerid] = 0;
    xprefls[playerid] = 0;
    prefsf[playerid] = 0;
    preflv[playerid] = 0;
    nobanco[playerid] = 0;
    nobarls[playerid] = 0;
    nobarsf[playerid] = 0;
    nobarlv[playerid] = 0;
    nobarfc[playerid] = 0;
    nautlls[playerid] = 0;
    nautllv[playerid] = 0;
    algemado[playerid] = 0;
    sequestro[playerid] = 0;
    infratores[playerid] = 0;
    vercmds[playerid] = 0;
    verpms[playerid] = 0;
    gmod[playerid] = 0;
    vmod[playerid] = 0;
    noevento[playerid] = 0;
    GPS_Spawned[playerid] = 1;

    // Hospital
    if(SeMorreu[playerid] == true && nogame[playerid] == 0 && NaFaculdade[playerid] == 0)
    {
        new randmaca = random(sizeof(MacaAposMorrer));

        SetPlayerHealth(playerid, 5.0);
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid, MacaAposMorrer[randmaca][0], MacaAposMorrer[randmaca][1], MacaAposMorrer[randmaca][2]);

        SetPlayerFacingAngle(playerid, MacaAposMorrer[randmaca][3]);
        SetPlayerCameraPos(playerid, 1159.3287, -1314.6178, 482.0693);
        SetPlayerCameraLookAt(playerid, 1164.3419, -1305.1895, 480.5693);

        ClearChatbox(playerid, 10);
        TogglePlayerControllable(playerid, false);

        #if defined AnimLoopsUser
        LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
        #else
        ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
        #endif

        TimerExRecuperou[playerid] = SetTimerEx("RecuperouSe", 1000, true, "e", playerid);
        GameTextForPlayer(playerid, "~r~Recuperando-se... Aguarde sua vida encher...", 10000, 4);
    }
    else
    {
        SeMorreu[playerid] = false;
        SetPlayerInterior(playerid, 0);
        SetCameraBehindPlayer(playerid);
    }

    if(NaFaculdade[playerid] == 1)
    {
        SetPlayerHealth(playerid, 999999.0);
        SetPlayerInterior(playerid, 3);
        SetPlayerPos(playerid, 1494.4003, 1304.2990, 1093.2891);
        TogglePlayerControllable(playerid, 1);
    }

    if(dini_Exists(file))
    {
        // Casamento
        if(dini_Int(file, "Casado") == 3)
        {
            format(string, sizeof(string), "{FF00EE}%s se divorciou de vocк.\n{FFFF00}Nгo perca tempo, case com outro(a).", dini_Get(file, "CasouCom"));

            dini_IntSet(file, "Casado", 0);
            dini_Set(file, "CasouCom", "Ninguem");

            ShowPlayerDialog(playerid, playersimp, DIALOG_STYLE_MSGBOX, "Divуrcio", string, "OK", "");
        }
        if(dini_Int(file, "novato") == 1)
        {
            if(SeMorreu[playerid] == false)
            {
                new gStr[ 256 ];
                new Ano, Mes,Dia;
                getdate(Ano, Mes,Dia);
                getdate(Anolog[playerid], Meslog[playerid],Dialog[playerid]);

                new Hora, Minuto, Segundo;
                gettime(Hora, Minuto, Segundo);
                gettime(Horalog[playerid], Minutolog[playerid], Segundolog[playerid]);

                format( gStr, sizeof( gStr ), "[ > ] Seu primeiro e ъltimo login foi {FFFFFF}[%d/%d/%d] аs %d:%d\r\n", Dia, Mes, Ano, Hora, Minuto);
                SendClientMessage( playerid, COLOR_AMARELO, gStr );
            }
        }
        if(dini_Int(file, "Procurado") == 0)
        {
            Procurados[playerid] = 0;
            SetPlayerWantedLevel(playerid, 0);
        }
        else
        {
            Procurados[playerid] = 1;
            SetPlayerWantedLevel(playerid, 2);
        }
        if(dini_Int(file, "Preso") == 1)
        {
            if(SeMorreu[playerid] == false)
            {
                PrenderPlayer(playerid);
                SendClientMessage(playerid, msgdm, "Vocк estб preso. Contrate um advogado ou pague a fianзa /fianca");
            }
        }
        else
        {
            preso[playerid] = 0;
        }
        if(nogame[playerid] == 1)
        {
            SetPlayerInterior(playerid, lanI[playerid]);
            SetPlayerPos(playerid, lanX[playerid], lanY[playerid], lanZ[playerid]);
            SetPlayerSkin(playerid, dini_Int(file, "Skin"));

            nogame[playerid] = 0;
            nobomber[playerid] = 0;
        }
        dini_IntSet(file, "convitent", 0);
        dini_IntSet(file, "Entrevista", 0);
        dini_IntSet(file, "MN", 0);
    }

    if(PlayerInfo[playerid][Logged] == 1)
    {
        if(dini_Int(file, "Sexo") == 0)
        {
            ShowPlayerDialog(playerid, skinnovato, DIALOG_STYLE_MSGBOX, "Gкnero", "{00ff00}Qual й seu sexo?\n\n", "Masculino", "Feminino");
        }
        else
        {
            if(pAdmin[playerid] > 0)
            {
                #if !defined SystemAdminUser
                pAdmin[playerid] = 0;
                dini_IntSet(file, "aAdmin", 0);
                ShowPlayerDialog(playerid, sisadminfo, DIALOG_STYLE_MSGBOX, "{FFFFFF}Aviso Importante aos ADM's", "{FF33FF}O sistema de Administraзгo do servidor foi desativado!\n\n{00FF00}Devido vбrios conflitos entre jogadores foi tomada esta decisгo.\n\n{99FFFF}O tempo para que seja normalizado o sistema ainda nгo foi definido.", "OK", "");
                #endif
            }
        }
        if(dini_Int(file, "Bloco") == 1)
        {
            format(string, sizeof(string), "Lembrete: %s", dini_Get(file, "Lembrete"));
            SendClientMessage(playerid, Cinza, string);
        }
        if(PlayerInfo[playerid][SpawnDance] == false)
        {
            KillTimer(PlayerInfo[playerid][SpawnTimer]);
            PlayerInfo[playerid][SpawnAngle] = 0.0;
            PlayerInfo[playerid][SpawnDance] = true;
        }

        if(SeMorreu[playerid] == false)
        {
            SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 357.9491, 0, 0, 0, 0, 0, 0);
            Logarprof(playerid);
        }
    }
    else
    {
        RandomSpawnPlayer(playerid);
        if(PlayerInfo[playerid][SpawnDance])
        {
            PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid);
            PlayerInfo[playerid][SpawnDance] = false;
        }
    }

    if(SeMorreu[playerid] == false)
    {
        TogglePlayerControllable(playerid, false);
        SetTimerEx("DestogglePlayerControllable", 1000, 0, "d", playerid);
    }
    return 1;
}
Reply
#6

Bom nгo percebi nada de errado nesse script serб que vocк nгo declarou uma Variбvel playerid no Topo do GM

Sei que pode ser uma coisa inъtil mais vai saber nй '-'
Reply
#7

Quote:
Originally Posted by FallweN
Посмотреть сообщение
Bom nгo percebi nada de errado nesse script serб que vocк nгo declarou uma Variбvel playerid no Topo do GM

Sei que pode ser uma coisa inъtil mais vai saber nй '-'
tipo me da uma variavel com o id 0
Reply
#8

Mude:
pawn Код:
TimerExRecuperou[playerid] = SetTimerEx("RecuperouSe", 1000, true, "e", playerid);
Para:

pawn Код:
TimerExRecuperou[playerid] = SetTimerEx("RecuperouSe", 1000, true, "d", playerid);
Nгo sei se й a fonte do problema mas esta errado e pode ter algo relacionado.
Reply
#9

Quote:
Originally Posted by Dieguinho
Посмотреть сообщение
tipo me da uma variavel com o id 0
new ashuauhsau;

essa variбvel assume o valor 0. no caso, id 0.
Reply
#10

Tipo tenho varias assim sera q o erro e ne uma loop ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)