[Help]Problem with sscanf
#1

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

PHP код:

stock LoadPlayerObject
(playerid)
{
    new 
modelidboneidFloat:fOffsetXFloat:fOffsetYFloat:fOffsetZFloat:fRotXFloat:fRotYFloat:fRotZFloat:fScaleXFloat:fScaleYFloat: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(playeridSLOT_TESTAmodelidboneidfOffsetXfOffsetYfOffsetZfRotXfRotYfRotZfScaleXfScaleYfScaleZ);
        
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(playeridSLOT_BOCCAmodelidboneidfOffsetXfOffsetYfOffsetZfRotXfRotYfRotZfScaleXfScaleYfScaleZ);
        
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(playeridSLOT_OCCHImodelidboneidfOffsetXfOffsetYfOffsetZfRotXfRotYfRotZfScaleXfScaleYfScaleZ);
        
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:360,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
[14:36:3618964,2,0.12,0.01,0.00,90.00,100.00,0.00,1.00,1.00,1.00
[14:36:360,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
[14:36:3618911,2,-0.07,0.02,0.00,90.00,-180.00,-90.00,1.00,1.00,1.00
[14:36:360,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
[14:36:3619020,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: 1 Guest(s)