25.04.2012, 14:27
(
Последний раз редактировалось xX_Simon_Xx; 25.04.2012 в 18:10.
)
I do a system to save only the objects attached to the player that I would save all the 9 fields of '"SetPlayerAttachedObject" in one field of mysql instead of create 9.
Else is needed to use sscanf, but I do not understand how to use it to split a string.
well now I have made the function to insert values in database
I do not know how to separate the various fields separated by a comma and assign to each variable and mostly how to convert the string into a numeric variable
Else is needed to use sscanf, but I do not understand how to use it to split a string.
well now I have made the function to insert values in database
PHP код:
stock SavePlayerObject(playerid, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
new string[500];
switch(index)
{
case SLOT_TESTA:
{
format(string,sizeof(string),"%d,%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "OggettoTesta",string);
}
case SLOT_BOCCA:
{
format(string,sizeof(string),"%d,%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "OggettoBocca",string);
}
case SLOT_OCCHI:
{
format(string,sizeof(string),"%d,%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "OggettoOcchi",string);
}
}
}
PHP код:
stock LoadPlayerObject(playerid)
{
new index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ;
//the string with all values it's PlayerInfo[playerid][pOggTesta]
SetPlayerAttachedObject(playerid, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
}