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;
- function int BasicButton(str image, int bx, int by, int bwidth, int bheight, int bid)
- {
- SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
- if(mouseX > bx - bwidth/2 && mouseX < bx + bwidth/2 && mouseY > by - bheight/2 && mouseY < by + bheight/2)
- {
- if(keyPressed(BT_ATTACK) == 1)
- {
- return 1;
- }
- else if(keyPressed(BT_ALTATTACK) == 1)
- {
- return 2;
- }
- }
- SetFont(image);
- HudMessage(s:"A"; HUDMSG_PLAIN, bid, 0, bx*1.0, by*1.0, 0);
- return false;
- }
- script "ShopSystemz" (void)
- {
- int mouseX+ = GetPlayerInput(-1, INPUT_YAW);
- int mouseY+ = GetPlayerInput(-1, INPUT_PITCH);
- while(TRUE)
- {
- mouseX -= mouseX+ / SENSITIVITY_X;
- mouseY -= mouseY+ / SENSITIVITY_Y;
- // move the cursor
- mouseX+ = GetPlayerInput(-1, INPUT_YAW);
- mouseY+ = GetPlayerInput(-1, INPUT_PITCH);
- // 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);
- Delay(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement