#include <YSI\y_ini>
#define ACCOUNTS_PATH "Players/%s.ini" //Saving folder..
public OnPlayerConnect(playerid) //Or when player login..
{
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME);
new File[100];format(File, 100, ACCOUNTS_PATH, name);
INI_ParseFile(File, "LoadSkin", .bExtra = true, .extra = playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME],
file[100];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(file, 128, ACCOUNTS_PATH, name);
new INI:ACCOUNT = INI_Open(file);
INI_WriteInt(ACCOUNT, "Skin", GetPlayerSkin(playerid));
return 1;
}
forward LoadSkin(playerid, name[], value[]);
public LoadSkin(playerid, name[], value[])
{
new skin;
INI_Int("Skin", skin);
SetPlayerSkin(playerid, skin);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/clothes", true)) { new string[128]; for(new x;x<MAX_PLAYER_ATTACHED_OBJECTS;x++) { if(IsPlayerAttachedObjectSlotUsed(playerid, x)) format(string, sizeof(string), "%s%d (Used)\n", string, x); else format(string, sizeof(string), "%s%d\n", string, x); } ShowPlayerDialog(playerid, DIALOG_ATTACH_INDEX_SELECTION, DIALOG_STYLE_LIST, \ "{FF0000}Clothes", string, "Select", "Cancel"); return 1; } return SendClientMessage(playerid, COLOR_RED, "Invalid Command - Type /cmds to see a list of available commands."); } |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_ATTACH_INDEX_SELECTION: { if(response) { if(IsPlayerAttachedObjectSlotUsed(playerid, listitem)) { ShowPlayerDialog(playerid, DIALOG_ATTACH_EDITREPLACE, DIALOG_STYLE_MSGBOX, \ "{FF0000}Attachment Modification", "Do you wish to edit the attachment in that slot, or delete it?", "Edit", "Delete"); } else { new string[4000+1]; for(new x;x<sizeof(AttachmentObjects);x++) { format(string, sizeof(string), "%s%s\n", string, AttachmentObjects[x][attachname]); } ShowPlayerDialog(playerid, DIALOG_ATTACH_MODEL_SELECTION, DIALOG_STYLE_LIST, \ "{FF0000}Attachment Modification - Model Selection", string, "Select", "Cancel"); } SetPVarInt(playerid, "AttachmentIndexSel", listitem); } return 1; } case DIALOG_ATTACH_EDITREPLACE: { if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel")); else RemovePlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel")); DeletePVar(playerid, "AttachmentIndexSel"); return 1; } case DIALOG_ATTACH_MODEL_SELECTION: { if(response) { if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, listitem); else { SetPVarInt(playerid, "AttachmentModelSel", AttachmentObjects[listitem][attachmodel]); new string[256+1]; for(new x;x<sizeof(AttachmentBones);x++) { format(string, sizeof(string), "%s%s\n", string, AttachmentBones[x]); } ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \ "{FF0000}Attachment Modification - Bone Selection", string, "Select", "Cancel"); } } else DeletePVar(playerid, "AttachmentIndexSel"); return 1; } case DIALOG_ATTACH_BONE_SELECTION: { if(response) { SetPlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"), GetPVarInt(playerid, "AttachmentModelSel"), listitem+1); EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel")); SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around."); } DeletePVar(playerid, "AttachmentIndexSel"); DeletePVar(playerid, "AttachmentModelSel"); return 1; } } return 0; } 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 ) { new debug_string[256+1]; format(debug_string,256,"SetPlayerAttachedObject(p layerid,%d,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f)", index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fR otX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ); print(debug_string); SetPlayerAttachedObject(playerid,index,modelid,bon eid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,f ScaleX,fScaleY,fScaleZ); SendClientMessage(playerid, 0xFFFFFFFF, "You finished editing an attached object"); return 1; } |