function onScriptLoad()
{
VK_F1 <- BindKey(true,0x70,0,0);
VK_F2 <- BindKey(true,0x71,0,0);
VK_F3 <- BindKey(true,0x72,0,0);
VK_F4 <- BindKey(true,0x73,0,0);
VK_F12 <- BindKey(true,0x7B,0,0);
}
function onKeyDown( player, key )
{
if (key == VK_F1) {
player.Pos = Vector(-914.502,390.746,10.9877)
MessagePlayer("[#ffffff]You got teleported to bf", player)
}
if (key == VK_F2) {
player.Pos = Vector(-879.502,-340.762,11.1034)
MessagePlayer("[#ffffff]You got teleported to El Banco Corrupto Grande", player)
}
if (key == VK_F3) {
player.Pos = Vector(-1364.4,-923.758,20.8931)
MessagePlayer("[#ffffff]You got teleported to Escobar international", player)
}
if (key == VK_F4) {
player.Pos = Vector(-1721.28,-245.769,14.6186)
MessagePlayer("[#ffffff]You got teleported to Fort Baxter Air Base", player)
}
if (key == VK_F12) {
local veh = player.Vehicle;
if (veh) {
MessagePlayer("[#ffffff]Vehicle Fixed!", player)
veh.Fix();
}
else {
MessagePlayer("[#ffffff]You're not in a vehicle", player)
}
}
}
Bindkey's
F1 - Teleports to everyone's favorite deathmatch zone (BF)
F2 - Teleports to El Banco Corrupto Grande
F3 - Teleports to Escobar International Airport
F4 - Teleports to Fort Baxter Military
F12 - Fixes vehicle
Goodluck of using my script
Nice Work!
Recomandations:
1.) Use client-side keybinds.
2.) Use switch-cases
3.) Global variables can be also defined outside of the functions.
4.) I recommend using constants instead of repeating values and texts.
Quote from: Athanatos on Aug 01, 2019, 07:29 PMRecomandations:
3.) Global variables can be also defined outside of the functions.
I don't really see how this is a recommendation, global variables can be defined anywhere you want.
Quote from: Xmair on Aug 02, 2019, 05:42 AMQuote from: Athanatos on Aug 01, 2019, 07:29 PMRecomandations:
3.) Global variables can be also defined outside of the functions.
I don't really see how this is a recommendation, global variables can be defined anywhere you want.
`CAN BE ALSO`
Read again.