Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Function :
- SetPlayerSkinEx(playerid, skinid) // return an error msg if invalid skin id (higher than sizeof custom_skin)
- GetCustomSkinID(skinid) // return the CUSTOM id not the row /!\
- */
- enum
- {
- CUSTOM_INVALID = 20000, // dont modify the id 20000
- CUSTOM_COP,
- CUSTOM_WIFE
- }
- // baseskin, newid, dff, txd
- new custom_skin[][][] =
- {
- {14,CUSTOM_INVALID, "Mila.dff", "Mila.txd"}, // Let the skin with INVALID id, and a VALID data to prevent a load bug, refer sa:mp forum
- {14,CUSTOM_WIFE,"Mila.dff", "Mila.txd"},
- {14,CUSTOM_COP,"lvpdpc2.dff","lvpdpc2.txd"}
- };
- public OnGameModeInit()
- {
- SkinModel_Init();
- return 1;
- }
- stock SkinModel_Init()
- {
- for(new i; i< sizeof custom_skin; i++)
- {
- new baseskin, newskin;
- baseskin = strdec(custom_skin[i][0]);
- newskin = strdec(custom_skin[i][1]);
- printf("Loading Charmodel : %d, %d, '%s', '%s'", custom_skin[i][0], custom_skin[i][1], custom_skin[i][2], custom_skin[i][3]);
- new result = AddCharModel(baseskin, newskin, custom_skin[i][2], custom_skin[i][3]);
- if(result)
- printf(" Skinid : %d loaded !", i);
- else
- printf("Loading Charmodel : ERROR when loading the skin : %d", i);
- }
- return 1;
- }
- // strdec is to prevent an incorrect value format in the addcharmodel function.
- stock strdec(string[]) // may not working for other string to decimal, but its working 100% for this system !!!
- {
- new var_str[50];
- format(var_str, 50, "%i", string);
- return strval(var_str);
- }
- stock SetPlayerSkinEx(playerid, skinid)
- {
- if(skinid >= sizeof(custom_skin))
- { SendClientMessage(playerid, COLOR_ERROR, "[Skin] skinid invalide."); return 1; }
- printf("skin id : %d, base id : %d, new id : %d", skinid, custom_skin[skinid][0], custom_skin[skinid][1]);
- SetPlayerSkin(playerid, strdec(custom_skin[skinid][1]));
- return 1;
- }
- stock GetCustomSkinID(skinid)
- {
- return custom_skin[skinid][1];
- }
- // EXEMPLE !
- cmd:setcustom(playerid, params[])
- {
- if(!isAdminWriter(playerid)) { return noAccess(playerid); }
- new target, skinid;
- if(sscanf(params, "ud", target, skinid)) return SendClientMessage(playerid, COLOR_USAGE, "[Usage] /setcustom <playerid> <skinid>");
- SetPlayerSkinEx(target, skinid); // check of the "id" in the function
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment