Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * S32_Skins - Nice skin selection!
- * Copyright(c)System32
- * This file is provided as is (no warranties)
- * Credits:
- * System32 - Almost everything!
- */
- #include <a_samp>
- forward SkinChoosing(playerid);
- new SkinTimer[MAX_PLAYERS], ChoosingStep[MAX_PLAYERS], SkinChoosed[MAX_PLAYERS], DisabledRight[MAX_PLAYERS], DisabledLeft[MAX_PLAYERS];
- new Text: TDSkin, Text: TDBuy, Text: TDExit, Text: TDBackground, Text: TDSkinID;
- public OnFilterScriptInit()
- {
- print("\n");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4");
- print(" \4 S32_Skins \4");
- print(" \4 by \4");
- print(" \4 System32 \4");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\n");
- TDSkin = TextDrawCreate(480.000000, 250.000000, "~<~Skin~>~");
- TextDrawBackgroundColor(TDSkin, 255);
- TextDrawFont(TDSkin, 2);
- TextDrawLetterSize(TDSkin, 0.579999, 1.600000);
- TextDrawColor(TDSkin, 568131839);
- TextDrawSetOutline(TDSkin, 0);
- TextDrawSetProportional(TDSkin, 1);
- TextDrawSetShadow(TDSkin, 1);
- TDBuy = TextDrawCreate(499.000000, 266.000000, "Buy");
- TextDrawBackgroundColor(TDBuy, 255);
- TextDrawFont(TDBuy, 2);
- TextDrawLetterSize(TDBuy, 0.579999, 1.600000);
- TextDrawColor(TDBuy, 16777215);
- TextDrawSetOutline(TDBuy, 0);
- TextDrawSetProportional(TDBuy, 1);
- TextDrawSetShadow(TDBuy, 1);
- TDExit = TextDrawCreate(497.000000, 283.000000, "Exit");
- TextDrawBackgroundColor(TDExit, 255);
- TextDrawFont(TDExit, 2);
- TextDrawLetterSize(TDExit, 0.579999, 1.700000);
- TextDrawColor(TDExit, -16776961);
- TextDrawSetOutline(TDExit, 0);
- TextDrawSetProportional(TDExit, 1);
- TextDrawSetShadow(TDExit, 1);
- TDBackground = TextDrawCreate(570.000000, 251.000000, ".");
- TextDrawBackgroundColor(TDBackground, 255);
- TextDrawFont(TDBackground, 1);
- TextDrawLetterSize(TDBackground, 0.000000, 5.399996);
- TextDrawColor(TDBackground, -1);
- TextDrawSetOutline(TDBackground, 0);
- TextDrawSetProportional(TDBackground, 1);
- TextDrawSetShadow(TDBackground, 1);
- TextDrawUseBox(TDBackground, 1);
- TextDrawBoxColor(TDBackground, 50);
- TextDrawTextSize(TDBackground, 475.000000, 1.000000);
- TDSkinID = TextDrawCreate(327.000000, 24.000000, "0 - 1 - 2");
- TextDrawAlignment(TDSkinID, 2);
- TextDrawBackgroundColor(TDSkinID, 255);
- TextDrawFont(TDSkinID, 1);
- TextDrawLetterSize(TDSkinID, 0.500000, 1.000000);
- TextDrawColor(TDSkinID, 16711935);
- TextDrawSetOutline(TDSkinID, 0);
- TextDrawSetProportional(TDSkinID, 1);
- TextDrawSetShadow(TDSkinID, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(TDSkin);
- TextDrawDestroy(TDBuy);
- TextDrawDestroy(TDExit);
- TextDrawDestroy(TDBackground);
- TextDrawDestroy(TDSkinID);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SkinTimer[playerid] = 0;
- ChoosingStep[playerid] = 0;
- SkinChoosed[playerid] = 0;
- DisabledRight[playerid] = 0;
- DisabledLeft[playerid] = 0;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SkinTimer[playerid] = 0;
- ChoosingStep[playerid] = 0;
- SkinChoosed[playerid] = 0;
- DisabledRight[playerid] = 0;
- DisabledLeft[playerid] = 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_SECONDARY_ATTACK)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, 2244.4465,-1665.0327,15.4766))
- {
- TextDrawShowForPlayer(playerid, TDSkin);
- TextDrawShowForPlayer(playerid, TDBuy);
- TextDrawShowForPlayer(playerid, TDExit);
- TextDrawShowForPlayer(playerid, TDBackground);
- TextDrawShowForPlayer(playerid, TDSkinID);
- ChoosingStep[playerid] = 1;
- SkinChoosed[playerid] = 0;
- SetPVarInt(playerid, "PlayerSkin", GetPlayerSkin(playerid));
- SetPlayerSkin(playerid, 0);
- TogglePlayerControllable(playerid, 0);
- SetPlayerInterior(playerid, 14);
- SetPlayerPos(playerid, 258.8244,-40.8792,1002.0234);
- SetPlayerFacingAngle(playerid, 120);
- SetPlayerCameraPos(playerid, 256.0334,-42.4937,1003);
- SetPlayerCameraLookAt(playerid, 258.8244,-40.8792,1001.5);
- SetPlayerVirtualWorld(playerid, 9000);
- SkinTimer[playerid] = SetTimerEx("SkinChoosing", 200, 1, "d", playerid);
- SetPlayerCameraPos(playerid, 214.18, -101.81, 1006.05);
- SetPlayerCameraLookAt(playerid, 217.60, -98.28, 1005.12);
- SetPlayerPos(playerid, 217.2540,-99.4348,1005.2578);
- SetPlayerFacingAngle(playerid, 132.2318);
- SetPlayerInterior(playerid, 15);
- SendClientMessage(playerid, 0x10F441AA, "Use arrow key and F for action!");
- }
- else if(IsPlayerInRangeOfPoint(playerid, 2.0, 207.737991,-109.019996,1005.132812))
- {
- SetPlayerPos(playerid, 2244.4465,-1665.0327,15.4766);
- SetPlayerInterior(playerid, 0);
- }
- }
- return 1;
- }
- public SkinChoosing(playerid)
- {
- new keys, ud, lr;
- GetPlayerKeys(playerid, keys, ud, lr);
- if(ChoosingStep[playerid] == 1)
- {
- TextDrawSetString(TDSkin, "~w~~<~Skin~>~");
- if(ud > 0)
- {
- ChoosingStep[playerid] = 2;
- TextDrawSetString(TDSkin, "~<~Skin~>~");
- }
- if(lr > 0)
- {
- if(DisabledRight[playerid] == 0)
- {
- if(DisabledLeft[playerid] == 1) DisabledLeft[playerid] = 0;
- SetPlayerSkin(playerid, GetPlayerSkin(playerid) + 1);
- if(GetPlayerSkin(playerid) == 299) return DisabledRight[playerid] = 1;
- }
- }
- else if(lr < 0)
- {
- if(DisabledLeft[playerid] == 0)
- {
- if(DisabledRight[playerid] == 1) DisabledRight[playerid] = 0;
- SetPlayerSkin(playerid, GetPlayerSkin(playerid) - 1);
- if(GetPlayerSkin(playerid) == 0) return DisabledLeft[playerid] = 1;
- }
- }
- new string[128];
- if(GetPlayerSkin(playerid) == 0) format(string, sizeof(string), "~g~0 ~w~- 0 - ~g~1");
- else if(GetPlayerSkin(playerid) == 299) format(string, sizeof(string), "~g~298 ~w~- 299 - ~g~299");
- else format(string, sizeof(string), "~g~%d ~w~- %d - ~g~%d", GetPlayerSkin(playerid) - 1, GetPlayerSkin(playerid), GetPlayerSkin(playerid) + 1);
- TextDrawSetString(TDSkinID, string);
- }
- else if(ChoosingStep[playerid] == 2)
- {
- TextDrawSetString(TDBuy, "~w~Buy");
- if(keys == KEY_SECONDARY_ATTACK)
- {
- SkinChoosed[playerid] = 1;
- GivePlayerMoney(playerid, -1500);
- SendClientMessage(playerid, 0x10F441AA, "You choosed skin!");
- }
- else if(ud > 0)
- {
- ChoosingStep[playerid] = 3;
- TextDrawSetString(TDBuy, "Buy");
- }
- else if(ud < 0)
- {
- ChoosingStep[playerid] = 1;
- TextDrawSetString(TDBuy, "Buy");
- }
- }
- else if(ChoosingStep[playerid] == 3)
- {
- TextDrawSetString(TDExit, "~w~Exit");
- if(keys == KEY_SECONDARY_ATTACK)
- {
- TextDrawSetString(TDExit, "Exit");
- ChoosingStep[playerid] = 0;
- TextDrawHideForPlayer(playerid, TDSkin);
- TextDrawHideForPlayer(playerid, TDBuy);
- TextDrawHideForPlayer(playerid, TDExit);
- TextDrawHideForPlayer(playerid, TDBackground);
- TextDrawHideForPlayer(playerid, TDSkinID);
- ChoosingStep[playerid] = 0;
- TogglePlayerControllable(playerid, 1);
- SendClientMessage(playerid, 0x10F441AA, "You exited choosing skin!");
- SetPlayerPos(playerid, 207.737991,-109.019996,1005.132812);
- SetCameraBehindPlayer(playerid);
- if(SkinChoosed[playerid] == 0) SetPlayerSkin(playerid, GetPVarInt(playerid, "PlayerSkin"));
- else SetPlayerSkin(playerid, GetPlayerSkin(playerid));
- SkinChoosed[playerid] = 0;
- KillTimer(SkinTimer[playerid]);
- }
- else if(ud < 0)
- {
- ChoosingStep[playerid] = 2;
- TextDrawSetString(TDExit, "Exit");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement