Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: Alecu Madalin on Jul 31, 2019, 09:07 PM

Title: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: Alecu Madalin on Jul 31, 2019, 09:07 PM
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
Title: Re: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: Rardodus Bruise on Aug 01, 2019, 04:58 AM
Nice Work!
Title: Re: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: =RK=MarineForce on Aug 01, 2019, 08:55 AM
Quote from: Rardodus Bruise on Aug 01, 2019, 04:58 AMNice Work!
Title: Re: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: Alecu Madalin on Aug 01, 2019, 10:35 AM
Quote from: Rardodus Bruise on Aug 01, 2019, 04:58 AMNice Work!
Quote from: =RK=MarineForce on Aug 01, 2019, 08:55 AM
Quote from: Rardodus Bruise on Aug 01, 2019, 04:58 AMNice Work!

Thank you guys 8)
Title: Re: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: NicusorN5 on Aug 01, 2019, 07:29 PM
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.
Title: Re: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: Xmair on Aug 02, 2019, 05:42 AM
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.
Title: Re: [BINDKEY] + [TESTED] Basic Vehicle Fix + gotoloc's
Post by: NicusorN5 on Aug 02, 2019, 07:13 PM
Quote from: Xmair on Aug 02, 2019, 05:42 AM
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.
`CAN BE ALSO`
 
Read again.