Hi Everyone since Ventus (My Server) i am retiring for good this time i decided to give back to the community and help as i can so
1 or 2 Sundays a month i will donate some things from Ventus so people can use or learn from
Credit to this script goes to Emera
Setup:
1) Create a weapon (name it what you want)
2) Insert the script
3) add the weapon to you and a grey bar with boxes should appear at the bottom
Controls:
Right Click a box and your current equipped item will be added to hotkeys
Left Click a box the the item in it will be equipped
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.keycount = 10;
if (client.hotkeys == NULL) {
for (temp.i = 0; temp.i < this.keycount; temp.i ++) {
client.hotkeys.add("-");
}
}
drawGUI();
}
function drawGUI() {
Hotkeys.destroy();
new GuiControl("Hotkeys") {
useownprofile = true;
width = 10 + (thiso.keycount * 50);
height = 60;
x = (screenwidth - width) / 2;
y = (screenheight - height - 35);
with (profile) {
modal = true;
cankeyfocus = false;
opaque = true;
fillcolor = {0, 0, 0, 100};
}
}
for (temp.i = 0; i < thiso.keycount; i ++) {
with(Hotkeys) {
new GuiControl("Hotkey_" @ temp.i) {
useownprofile = true;
width = 40;
height = 40;
x = 10 + (temp.i * 50);
y = 10;
with(profile) {
opaque = true;
border = true;
fillcolor = {0, 0, 0, 100};
bordercolor = {255,255,255};
}
thiso.catchevent(this, "onMouseDown", "onLeft");
thiso.catchevent(this, "onRightMouseDown", "onRight");
new GuiBitmapCtrl("HotkeyImg_" @ temp.i) {
bitmap = "";
width = 32;
height = 32;
extent = {width, height};
x = 4;
y = 4;
//cliptobounds = true;
thiso.catchevent(this, "onMouseDown", "onLeft");
thiso.catchevent(this, "onRightMouseDown", "onRight");
}
}
}
}
loadKeys();
}
public function loadKeys() {
for (temp.i = 0; i < this.keycount; i ++) {
temp.hk = client.hotkeys[temp.i];
if (temp.hk != "-") {
if (findweapon(temp.hk) != NULL) {
temp.wepimg = findweapon(temp.hk).image;
if (temp.wepimg == NULL) {
temp.wepimg = "bcalarmclock.png";
}
("HotkeyImg_" @ temp.i).bitmap = wepimg;
} else {
client.hotkeys[temp.i] = "-";
("HotkeyImg_" @ temp.i).bitmap = "";
echo("Removed key" SPC temp.i SPC "because didn't exist");
}
}
}
}
function onLeft(obj) {
temp.hk = obj.substring(obj.pos("_") + 1) + 1;
temp.hki = temp.hk -= 1;
if (client.hotkeys[hki] == "-") {
player.chat = "No hotkey stored!";
} else {
player.chat = "Equipped:" SPC client.hotkeys[hki];
selectedweapon = player.weapons.index(findweapon(client.hotkeys[hki]));
}
GraalControl.makefirstresponder(true);
}
function onRight(obj) {
temp.hk = obj.substring(obj.pos("_") + 1) + 1;
temp.hki = temp.hk -= 1;
if (client.hotkeys[hki] == "-") {
temp.wepimg = findweapon(player.weapon).image;
if (wepimg == NULL) {
wepimg = "bcalarmclock.png";
}
client.hotkeys[hki] = player.weapon;
("HotkeyImg_" @ hki).bitmap = wepimg;
player.chat = "Added" SPC client.hotkeys[hki];
} else {
player.chat = "Cleared" SPC client.hotkeys[hki];
client.hotkeys[hki] = "-";
("HotkeyImg_" @ hki).bitmap = "";
}
GraalControl.makefirstresponder(true);
}
This Code is in NPC Scripting not Code Gallery, No Guarantees it's perfect