[BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's

Alecu Madalin

  • Jr. Member
  • Posts: 52
[BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
«  »
Code: [Select]
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

Rardodus Bruise

  • Newbie
  • Posts: 30

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 447
Try to UnderStand ME!

Alecu Madalin

  • Jr. Member
  • Posts: 52

Athanatos

  • Hero Member
  • Romania Cops N Robbers Lead Developer
  • Posts: 796
[BINDKEY] Re: + [TESTED] Basic Vehicle Fix + gotoloc's
« Reply #4,  »
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.

Xmair

  • Wiki Contributor
  • Posts: 874
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

Athanatos

  • Hero Member
  • Romania Cops N Robbers Lead Developer
  • Posts: 796