SA-MP Forums Archive
GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! (/showthread.php?tid=312001)



GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - vakhtang - 19.01.2012

So here is what is going on: each time dini saves player`s facing angle, it somehow gets 1.000000 everytime so when i reconnect my player spawns and looks at 1.000000 direction HERE IS CODE:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256], Float:X, Float:Y, Float:Z, Float:Angle;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
        dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
        dini_FloatSet(file, "PosX", X);
        dini_FloatSet(file, "PosY", Y);
        dini_FloatSet(file, "PosZ", Z);
        dini_IntSet(file, "Facing Angle", floatround(GetPlayerFacingAngle(playerid, Angle), floatround_ceil));
    }
    gPlayerLogged[playerid] = 0;

    new String_Leaving[64], Name_Left[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Name_Left,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Timed out)",Name_Left);
        case 1: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Leaving)",Name_Left);
        case 2: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Kicked/Banned)",Name_Left);
    }
    SendClientMessageToAll(COLOR_YELLOW,String_Leaving);
    return 1;
}



Re: GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - sabretur - 19.01.2012

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256], Float:X, Float:Y, Float:Z, Float:Angle;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerFacingAngle(playerid, Angle);
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
        dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
        dini_FloatSet(file, "PosX", X);
        dini_FloatSet(file, "PosY", Y);
        dini_FloatSet(file, "PosZ", Z);
        dini_IntSet(file, "Facing Angle", floatround(Angle, floatround_ceil));
    }
    gPlayerLogged[playerid] = 0;

    new String_Leaving[64], Name_Left[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Name_Left,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Timed out)",Name_Left);
        case 1: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Leaving)",Name_Left);
        case 2: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Kicked/Banned)",Name_Left);
    }
    SendClientMessageToAll(COLOR_YELLOW,String_Leaving);
    return 1;
}



AW: GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - Drebin - 19.01.2012

EDIT: up^


Re: GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - vakhtang - 19.01.2012

OMGF!!!!! Thanks guys this works


Re: GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - SuperViper - 19.01.2012

Just a note, facing angle is a float and you don't need to round it.


Respuesta: Re: GetPlayerFacingAngle(playerid, Angle) HELP!!!!!! - OPremium - 19.01.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Just a note, facing angle is a float and you don't need to round it.
He is saving it as an INTEGER, not a float