Originally Posted by Forum Rules
Script Requests - If you are requesting a script be made for you, rather than help with your coding, post in the Looking for scripters/helpers? Post here! Thread.
|
CMD:setskin(playerid,params[])
{
new SkinBroj,SkinID,poruka[128];
if(PlayerInfo[playerid][pAdministrator] <= 2) return SendClientMessage(playerid, -1,"Error: you don't have permission);
else if(SkinID < 0 || SkinID > 299) return SendClientMessage(playerid,-1,"Error: Chose your skin in [ 1 - 299 ]");
if(sscanf(params,"d",SkinID)) return SendClientMessage(playerid,-1,"Syntax: /setskin (Skin ID)");
else
{
SetPlayerSkin(playerid,SkinID);
SkinBroj = GetPlayerSkin(playerid);
format(poruka,sizeof(poruka),"You have chosen new skin. ID: %d",SkinBroj);
SendClientMessage(playerid,-1,poruka);
}
return 1;
}
#include <ZCMD>
#include <sscanf>
#include <a_samp>
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_inline>
#include <YSI\y_commands> // or zcmd
new gskin[MAX_PLAYERS];
CMD:skin(playerid, params[])
{
if(sscanf(params, "i", params[0]))
return SendClientMessage(playerid, -1, "usage: /skin [id].");
if(params[0] < 0 || params[0] > 299)
return SendClientMessage(playerid, -1, "ID invalid, min 0 max 299.");
SetPlayerSkin(playerid, params[0]);
SendClientMessage(playerid, -1, "Hass been changen your skin.");
return true;
}
public OnPlayerSpawn(playerid)
{
if(fexist(Folderskins(playerid)))
{
SetPlayerSkin(playerid, gskin[playerid]);
}
return true;
}
public OnPlayerRequestSpawn(playerid)
{
if(fexist(Folderskins(playerid)))
{
inline loadskin(string:name[], string:value[])
{
INI_Int("skin", gskin[playerid]);
}
INI_ParseFile(Folderskins(playerid), "loadskin");
SetPlayerSkin(playerid, gskin[playerid]);
}
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(Folderskins(playerid)) ;
INI_SetTag(File, "Skin user");
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));
INI_Close(File);
return true;
}
Folderskins(playerid)
{
new Name[MAX_PLAYER_NAME+1], string[85];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "/namefolder/%s.ini", Name);
return string;
}