10.07.2013, 10:45
So I Got No Errors And So.. i want to make a clothing system that actually saves...
so that is what i had
that is everything i had related to clothes
My problem is that the clothes don't load when i quit and rejoin..
My OnPlayerSpawn Callback cloth thing
PS. I am new to the forums.. so i wasn't sure how to put the script lines into the thread.
so that is what i had
that is everything i had related to clothes
pawn Код:
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
if(response)
{
SendClientMessage(playerid, COLOR_GREEN, "Attached Object Edition Saved.");
ao[playerid][index][ao_x] = fOffsetX;
ao[playerid][index][ao_y] = fOffsetY;
ao[playerid][index][ao_z] = fOffsetZ;
ao[playerid][index][ao_rx] = fRotX;
ao[playerid][index][ao_ry] = fRotY;
ao[playerid][index][ao_rz] = fRotZ;
ao[playerid][index][ao_sx] = fScaleX;
ao[playerid][index][ao_sy] = fScaleY;
ao[playerid][index][ao_sz] = fScaleZ;
SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Attached Object Edition Not Saved.");
new i = index;
SetPlayerAttachedObject(playerid, index, modelid, boneid, ao[playerid][i][ao_x], ao[playerid][i][ao_y], ao[playerid][i][ao_z], ao[playerid][i][ao_rx], ao[playerid][i][ao_ry], ao[playerid][i][ao_rz], ao[playerid][i][ao_sx], ao[playerid][i][ao_sy], ao[playerid][i][ao_sz]);
}
return 1;
}
stock CountAttachedObjects(playerid)
{
new count;
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, i)) count++;
}
return count;
}
stock GetFreeClothSlot()
{
new file[40];
for(new v = 0; v < MAX_CLOTHES; v++)
{
format(file, sizeof(file), "Clothes/%d.ini", v);
if(!fexist(file))
{
return v;
}
}
return -1;
}
stock CreatePlayerAttachedCloth(playerid,index,modelid,bone)
{
new c = GetFreeClothSlot();
SetPlayerAttachedObject(playerid, index ,modelid, bone);
EditAttachedObject(playerid,index);
new file[256];
format(file,256,"Clothes/%d.ini",c);
dini_Create(file);
dini_Set(file,"Owner",PlayerName(playerid));
dini_IntSet(file,"Model",modelid);
dini_IntSet(file,"Bone",bone);
dini_FloatSet(file,"cX",0.0);
dini_FloatSet(file,"cY",0.0);
dini_FloatSet(file,"cZ",0.0);
dini_FloatSet(file,"rX",0.0);
dini_FloatSet(file,"rY",0.0);
dini_FloatSet(file,"rZ",0.0);
dini_FloatSet(file,"sX",0.0);
dini_FloatSet(file,"sY",0.0);
dini_FloatSet(file,"sZ",0.0);
ao[playerid][index][ao_model] = dini_Int(file,"Model");
ao[playerid][index][ao_bone] = dini_Int(file,"Bone");
ao[playerid][index][ao_x] = dini_Float(file,"cX");
ao[playerid][index][ao_y] = dini_Float(file,"cY");
ao[playerid][index][ao_z] = dini_Float(file,"cZ");
ao[playerid][index][ao_rx] = dini_Float(file,"rX");
ao[playerid][index][ao_ry] = dini_Float(file,"rY");
ao[playerid][index][ao_rz] = dini_Float(file,"rZ");
ao[playerid][index][ao_sx] = dini_Float(file,"sX");
ao[playerid][index][ao_sy] = dini_Float(file,"sY");
ao[playerid][index][ao_sz] = dini_Float(file,"sZ");
}
stock LoadPlayerClothes(playerid)
{
new file[256];
for(new v = 0; v < MAX_CLOTHES; v++)
{
format(file, sizeof(file), "Clothes/%d.ini", v);
if(fexist(file))
{
if(!strcmp(PlayerName(playerid), dini_Get(file,"Owner"), false))
{
new index = CountAttachedObjects(playerid);
ao[playerid][index][ao_model] = dini_Int(file,"Model");
ao[playerid][index][ao_bone] = dini_Int(file,"Bone");
ao[playerid][index][ao_x] = dini_Float(file,"cX");
ao[playerid][index][ao_y] = dini_Float(file,"cY");
ao[playerid][index][ao_z] = dini_Float(file,"cZ");
ao[playerid][index][ao_rx] = dini_Float(file,"rX");
ao[playerid][index][ao_ry] = dini_Float(file,"rY");
ao[playerid][index][ao_rz] = dini_Float(file,"rZ");
ao[playerid][index][ao_sx] = dini_Float(file,"sX");
ao[playerid][index][ao_sy] = dini_Float(file,"sY");
ao[playerid][index][ao_sz] = dini_Float(file,"sZ");
}
}
}
return 1;
}
CMD:createcloth(playerid,params[])
{
new modelid;
new bone;
if(sscanf(params,"dd",modelid,bone)) return SendClientMessage(playerid,COLOR_RED,"Usage: /createcloth modelid bone");
if(PlayerInfo[playerid][pAdmin] == 0) return 0;
if(CountAttachedObjects(playerid) == 10) return SendClientMessage(playerid,COLOR_RED,"Error: {FFFFFF}You Cannot Create Anymore Clothes");
CreatePlayerAttachedCloth(playerid,CountAttachedObjects(playerid),modelid,bone);
return 1;
}
My OnPlayerSpawn Callback cloth thing
pawn Код:
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
new index = i;
if(IsPlayerAttachedObjectSlotUsed(playerid, i))
{
RemovePlayerAttachedObject(playerid, i);
SetPlayerAttachedObject(playerid, index, ao[playerid][index][ao_model], ao[playerid][index][ao_bone], ao[playerid][index][ao_x], ao[playerid][index][ao_y], ao[playerid][index][ao_z], ao[playerid][index][ao_rx], ao[playerid][index][ao_ry], ao[playerid][index][ao_rz], ao[playerid][index][ao_sx], ao[playerid][index][ao_sy], ao[playerid][index][ao_sz]);
return 1;
}
else
{
SetPlayerAttachedObject(playerid, index, ao[playerid][index][ao_model], ao[playerid][index][ao_bone], ao[playerid][index][ao_x], ao[playerid][index][ao_y], ao[playerid][index][ao_z], ao[playerid][index][ao_rx], ao[playerid][index][ao_ry], ao[playerid][index][ao_rz], ao[playerid][index][ao_sx], ao[playerid][index][ao_sy], ao[playerid][index][ao_sz]);
}
}
PS. I am new to the forums.. so i wasn't sure how to put the script lines into the thread.