SA-MP Forums Archive
[Problema] OnPlayerUpdate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [Problema] OnPlayerUpdate (/showthread.php?tid=339166)



[Problema] OnPlayerUpdate - Jex_Lafer - 02.05.2012

Quisiese que
Por ejemplo al tener el arma 5 (M4/AK47) Guardada se "SetPlayerAttachedObject" el objeto 355 en la espalda

pawn Код:
if(GetPlayerState(playerid)  == PLAYER_STATE_ONFOOT)
    {
        new Arma[MAX_PLAYERS],Bala[MAX_PLAYERS];
        GetPlayerWeaponData(playerid, 5, Arma[playerid], Bala[playerid]);
        if(Arma[playerid] == 30 && Bala[playerid] >= 1)//Ak-47
        {
               if(GetPlayerWeapon(playerid) == 30) RemovePlayerAttachedObject(playerid,5);
               else SetPlayerAttachedObject(playerid, 5, 355, 1, -0.060921, -0.141673, 0.000000, 0.000000, 35.362735, 0.000000);
        }
    }

Pero no funciona.. Lo he colocado en OnPlayerUpdate pero no actualiza


Respuesta: [Problema] OnPlayerUpdate - Fluid016 - 02.05.2012

Pone asн y decime si te funcionу.

pawn Код:
if(GetPlayerState(playerid)  == PLAYER_STATE_ONFOOT)
    {
        new Arma[MAX_PLAYERS],Bala[MAX_PLAYERS];
        GetPlayerWeaponData(playerid, 5, Arma[playerid], Bala[playerid]);
        if(Arma[playerid] == 30 && Bala[playerid] >= 1)//Ak-47
        {
               if(GetPlayerWeapon(playerid) == 30)SetPlayerAttachedObject(playerid, 5, 355, 1, -0.060921, -0.141673, 0.000000, 0.000000, 35.362735, 0.000000);
               else RemovePlayerAttachedObject(playerid,5);
        }
    }



Respuesta: [Problema] OnPlayerUpdate - Jex_Lafer - 02.05.2012

No funciono aun...


Respuesta: [Problema] OnPlayerUpdate - Daniel-92 - 02.05.2012

yo probe tu codigo y me funcionу bien, ten en cuenta que OnPlayerUpdate necesita retornar 1 para que se actualize el jugador.

No es necesario usar arrays usando MAX_PLAYERS, por que solo vas a usar 2 variables.
pawn Код:
public OnPlayerUpdate(playerid) {
    if(GetPlayerState(playerid)  == PLAYER_STATE_ONFOOT)
    {
        new Arma,Bala;
        GetPlayerWeaponData(playerid, 5, Arma, Bala);
        if(Arma == 30 && Bala >= 1)//Ak-47
        {
            if(GetPlayerWeapon(playerid) == 30) RemovePlayerAttachedObject(playerid,5);
            else SetPlayerAttachedObject(playerid, 5, 355, 1, -0.060921, -0.141673, 0.000000, 0.000000, 35.362735, 0.000000);
        }
    }
    return 1;
 }



Respuesta: [Problema] OnPlayerUpdate - Jex_Lafer - 02.05.2012

No tengo idea por que no funciona...
Borre todo el OnPlayerUpdate y solo coloque eso para probar y sigue sin funcionar