13.01.2012, 02:41
My samp.server.exe Crash when i type /setskin
Im not sure cuz maybe it got some errors i added this
pawn Код:
if(strcmp(cmd, "/setskin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setskin [playerid/PartOfName] [skin id]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(level > 299 || level < 1) { SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!"); return 1; }
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
PlayerInfo[para1][pModel] = level;
format(string, sizeof(string), "** Administrator %s Has Changed Your Skin.", sendername);
SendClientMessage(para1, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "** You Granted %s skin number %d.", giveplayer,level);
SendClientMessage(playerid, COLOR_ORANGE, string);
format(string, sizeof(string), "[ADMIN]: %s Gave The Skin [%d] to %s (%d).",sendername, level, giveplayer, para1);
ABroadCast(COLOR_LIGHTRED,string, 5);
SetPlayerSkin(para1, PlayerInfo[para1][pChar]);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Gave The Skin [%d] to %s",d,m,y,h,mi,s,sendername,level,giveplayer);
GiveLog(string);
}
}//not connected
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
pawn Код:
public IsValidSkin(skinid)
{
#define MAX_BAD_SKINS 22
new badSkins[MAX_BAD_SKINS] =
{ 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 268, 273, 289 };
if (skinid < 0 || skinid > 299) return false;
for (new i = 0; i < MAX_BAD_SKINS; i++) { if (skinid == badSkins[i]) return false; }
#undef MAX_BAD_SKINS
return 1;
}