SA-MP Forums Archive
[Help]Problem with sscanf - 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: [Help]Problem with sscanf (/showthread.php?tid=337435)



[Help]Problem with sscanf - xX_Simon_Xx - 26.04.2012

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]);"


Re: [Help]Problem with sscanf - SuperViper - 26.04.2012

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


Re: [Help]Problem with sscanf - xX_Simon_Xx - 26.04.2012

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


Re: [Help]Problem with sscanf - xX_Simon_Xx - 26.04.2012

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