11.08.2011, 11:29
How to make that a normal command ?
Код:
public OnFilterScriptInit() { print("\n========================================================"); print(" Best script"); print("========================================================\n"); for(new i = 0; i < MAX_PLAYERS; ++i) { MsgBox[i] = TextDrawCreate(453.000000, 119.000000, " You use a Cap"); TextDrawBackgroundColor(MsgBox[i], 15); TextDrawFont(MsgBox[i], 1); TextDrawLetterSize(MsgBox[i], 0.380000, 1.500000); TextDrawColor(MsgBox[i], -1); TextDrawSetOutline(MsgBox[i], 1); TextDrawSetProportional(MsgBox[i], 1); TextDrawUseBox(MsgBox[i], 1); TextDrawBoxColor(MsgBox[i], 100); TextDrawTextSize(MsgBox[i], 602.000000, 0.000000); if(IsPlayerConnected(i) && !IsPlayerNPC(i)) { pObject[i][slotreserved] = false; } } return 1; } public SendPlayerFormattedText(playerid, const str[], define) { new tmpbuf[256]; format(tmpbuf, sizeof(tmpbuf), str, define); SendClientMessage(playerid, 0xFF004040, tmpbuf); } CMD:hat(playerid, params[]) { 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; } CMD:backcaps(playerid, params[]) { new skin, id = strval(params[0]), beret, slot = GetEmptySlot(playerid), count; if(id <= 0 || id > 5) return SendClientMessage(playerid, 0xFFFFFFAA, "Use: /backcaps [1 - 5]"); skin = (GetPlayerSkin(playerid) - 1); switch(id) { case 1: beret = 18939; case 2..5: beret = 18939 + id; } do { if(skin == invalidcapsskins[count]) return SendClientMessage(playerid, 0xFFFFFFAA, "Your skin do not support a cap."); count++; } while(count < sizeof invalidcapsskins); 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, SkinCapsSet[skin][0], SkinCapsSet[skin][1], SkinCapsSet[skin][2], SkinCapsSet[skin][3], SkinCapsSet[skin][4], SkinCapsSet[skin][5]); GivePlayerMoney(playerid, -500); return 1; } CMD:removeob(playerid, params[]) { if(UseHat(playerid)) { RemovePlayerAttachedObject(playerid, pObject[playerid][oslot]); pObject[playerid][oslot] = -1; pObject[playerid][slotreserved] = false; TextDrawSetString(MsgBox[playerid]," Cap removed"); TextDrawShowForPlayer(playerid, MsgBox[playerid]); SetTimerEx("Hide", 3000, false, "d", playerid); return 1; } return SendClientMessage(playerid, 0xFFFFFFAA, "You aren't using hat/backcaps."); } CMD:helphat(playerid) { SendClientMessage(playerid, COLOR_GREEN1, "Ulric Hat/BackCaps system by Xaviour212/Dimas_Rizward."); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type: /hat [1 - 12] to use a Hat."); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type: /backcaps [1 - 5] to use a BackCaps."); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type: /removeob to removed your hat and backcaps."); return 1; } SetPlayerAttachedObjectEx(playerid, slot, model, bone, Float:X, Float:Y, Float:Z, Float:RX, Float:RY, Float:RZ) { if(!pObject[playerid][slotreserved]) { pObject[playerid][slotreserved] = true; pObject[playerid][omodel] = model; pObject[playerid][oslot] = slot; SetPlayerAttachedObject(playerid, slot, model, bone, X, Y, Z, RX, RY, RZ); } else { SetPlayerAttachedObject(playerid, pObject[playerid][oslot], model, bone, X, Y, Z, RX, RY, RZ); } return 1; }