[Help]Problem with sscanf
#1

I have done this function for load and attach saved player attached object

PHP код:

stock LoadPlayerObject
(playerid)
{
    new 
modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ;
    
/*Don't Work*/sscanf(PlayerInfo[playerid][pOggTesta], "p<,>ddfffffffff",modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
    if(
modelid != -1)
    {
        new 
string[60];
        
SetPlayerAttachedObject(playerid, SLOT_TESTA, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
        
format(string,sizeof(string),"%d,%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
        
SendClientMessage(playerid,COLOR_WHITE,string);
        
SendClientMessage(playerid,COLOR_WHITE,PlayerInfo[playerid][pOggTesta]);
    }
    
/*Don't Work*/sscanf(PlayerInfo[playerid][pOggBocca], "p<,>ddfffffffff",modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
    if(
modelid != -1)
    {
        new 
string[60];
        
SetPlayerAttachedObject(playerid, SLOT_BOCCA, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
        
format(string,sizeof(string),"%d,%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
        
SendClientMessage(playerid,COLOR_WHITE,string);
        
SendClientMessage(playerid,COLOR_WHITE,PlayerInfo[playerid][pOggBocca]);
    }
    
/*Don't Work*/sscanf(PlayerInfo[playerid][pOggOcchi], "p<,>ddfffffffff", modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
    if(
modelid != -1)
    {
        new 
string[60];
        
SetPlayerAttachedObject(playerid, SLOT_OCCHI, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
        
format(string,sizeof(string),"%d,%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
        
SendClientMessage(playerid,COLOR_WHITE,string);
        
SendClientMessage(playerid,COLOR_WHITE,PlayerInfo[playerid][pOggOcchi]);
    }
} 
But the sscanf don't give the right value to variable and ingame return this

PHP код:

[14:36:36] 0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
[14:36:36] 18964,2,0.12,0.01,0.00,90.00,100.00,0.00,1.00,1.00,1.00
[14:36:36] 0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
[14:36:36] 18911,2,-0.07,0.02,0.00,90.00,-180.00,-90.00,1.00,1.00,1.00
[14:36:36] 0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
[14:36:36] 19020,2,0.09,0.03,0.00,88.00,75.00,0.00,1.00,1.00,1.00 
the string with all 0 it's generated by this "SendClientMessage(playerid,COLOR_WHITE,string );"
and the other by "SendClientMessage(playerid,COLOR_WHITE,Player Info[playerid][pOggOcchi]); SendClientMessage(playerid,COLOR_WHITE,PlayerInfo[playerid][pOggBocca]); and SendClientMessage(playerid,COLOR_WHITE,PlayerInfo[playerid][pOggTesta]);"
Reply
#2

The sscanf lines look fine to me. It's most likely a problem with loading onto the variable 'pOggBocca'.
Reply
#3

no because
SendClientMessage(playerid,COLOR_WHITE,PlayerInfo[playerid][pOggBocca]);
return
18911,2,-0.07,0.02,0.00,90.00,-180.00,-90.00,1.00,1.00,1.00
Reply
#4

SOLVED i just changed "p<,>ddfffffffff" to "p,ddfffffffff" and now work
Reply


Forum Jump:


Users browsing this thread: