Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #DEFINE SCREEN_WIDTH 800
- #DEFINE SCREEN_HEIGHT 600
- #DEFINE SENSITIVITY_X 30
- #DEFINE SENSITIVITY_Y 30
- int mouseX;
- int mouseY;
- int ShopGUIOpen[8];
- function int ButtonText(str text, int holdtime, str font, int color)
- {
- SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
- if(font == 0) SetFont("SmallFont");
- else SetFont(font);
- HudMessage(s:text; HUDMSG_FADEOUT, 8000, color, 0.5, 0.5, holdtime, 0.3);
- return false;
- }
- function int BasicButton(str image, str image2, int bx, int by, int bwidth, int bheight, int bid)
- {
- SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
- if(mouseX > bx - bwidth && mouseX < bx + bwidth && mouseY > by - bheight && mouseY < by + bheight)
- {
- if(keyPressed(BT_ATTACK) == 1) return 1;
- else if(keyPressed(BT_ALTATTACK) == 1) return 2;
- }
- SetFont(image);
- if(mouseX > bx - bwidth && mouseX < bx + bwidth && mouseY > by - bheight && mouseY < by + bheight) SetFont(image2);
- HudMessage(s:"A"; HUDMSG_FADEOUT, bid, 0, bx*1.0+0.1, by*1.0+0.1, 0.1, 0.3);
- return false;
- }
- script "ToggleShopSystem" (void)
- {
- if(ShopGUIOpen[PlayerNumber()] == 0)
- {
- SetPlayerProperty(0, 1, PROP_TOTALLYFROZEN);
- ACS_NamedExecute("ShopSystemz", 0);
- ShopGUIOpen[PlayerNumber()] = 1;
- mouseX = 0;
- mouseY = 0;
- }
- else
- {
- SetPlayerProperty(0, 0, PROP_TOTALLYFROZEN);
- ACS_NamedTerminate("ShopSystemz", 0);
- ShopGUIOpen[PlayerNumber()] = 0;
- mouseX = 0;
- mouseY = 0;
- }
- }
- script "ShopSystemz" (void)
- {
- int mouseXadd = GetPlayerInput(-1, INPUT_YAW);
- int mouseYadd = GetPlayerInput(-1, INPUT_PITCH);
- while(TRUE)
- {
- if(BasicButton("ARTITOME", "ARTITOME", 50, 50, 12, 11, 1000) == 2) ButtonText("HUE", 1.0, "DBigFont", CR_UNTRANSLATED);
- else if(BasicButton("ARTITOME", "ARTITOME", 50, 50, 12, 11, 1000) == 1) ButtonText("SATURATION", 1.0, "DBigFont", CR_UNTRANSLATED);
- // move the cursor
- mouseXadd = GetPlayerInput(-1, INPUT_YAW);
- mouseYadd = GetPlayerInput(-1, INPUT_PITCH);
- mouseX -= mouseXadd / SENSITIVITY_X;
- mouseY -= mouseYadd / SENSITIVITY_Y;
- // prevent the cursor from going offscreen
- if(mouseX < 0) mouseX = 0;
- if(mouseX > SCREEN_WIDTH) mouseX = SCREEN_WIDTH;
- if(mouseY < 0) mouseY = 0;
- if(mouseY > SCREEN_HEIGHT) mouseY = SCREEN_HEIGHT;
- SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
- SetFont("CURSOR");
- HudMessage(s:"A"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, mouseX*1.0, mouseY*1.0, 0.04);
- Delay(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement