11.08.2011, 11:45
I just recommend you uzing ZCMD, Since it's faster. You are also making a roleplay server means alot of commands is making your server slow.
Place that onder OnPlayerCommand, If you have any errors drop them here.
pawn Код:
if(strcmp(cmd, "/hat", true) == 0)
{
new skin, id = strval(params[0]), beret, slot = GetEmptySlot(playerid), count;
if(id <= 0 || id > 12) return SendClientMessage(playerid, 0xFFFFFFAA, "Use: /hat [1 - 12]");
skin = (GetPlayerSkin(playerid) - 1);
switch(id)
{
case 1: beret = 18926;
case 2..10: beret = 18926 + id;
case 11: beret = 19099;
case 12: beret = 19098;
}
do
{
if(skin == invalidskins[count]) return SendClientMessage(playerid, 0xFFFFFFAA, "Your skin do not support a cap.");
count++;
}
while(count < sizeof invalidskins);
if(skin < 0) skin = 0;
if(slot == -1) return SendClientMessage(playerid, 0xFFFFFFAA, "You're holding the maximum of objects possible.");
TextDrawSetString(MsgBox[playerid]," You use a Cap");
TextDrawShowForPlayer(playerid, MsgBox[playerid]);
SetTimerEx("Hide", 3000, false, "d", playerid);
SetPlayerAttachedObjectEx(playerid, slot, beret, 2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
GivePlayerMoney(playerid, -500);
return 1;
}