« [ GameMode ] ADM Script v1.0
Simple Tooled-Up system from VC for VCMP

Sonmez

  • Jr. Member
  • Yo! It's time to play the fair game!
  • Posts: 58
Simple Tooled-Up system from VC for VCMP
«  »Last edited
You can use this system for Ammunation either. I wrote this code in 30 minutes. If you find any bug reply it.

Code: [Select]
class Ammunation
{
    AmmunationActive = false;
    wepapponscr = 0;
    wepreplcewarn = 0;
}

function onScriptLoad()
{
    ENTER <- BindKey( true, 0x0D, 0, 0 );
    ESC <- BindKey( true, 0x1B, 0, 0 );
    BACKSPACE <- BindKey( true, 0x08, 0, 0 );
    ArrowUp <- BindKey( true, 0x26, 0, 0 );
    ArrowDown <- BindKey( true, 0x28, 0, 0 );
    ArrowLeft <- BindKey( true, 0x25, 0, 0 );
    ArrowRight <- BindKey( true, 0x27, 0, 0 );
    ammunationcpid <- 0;
    ammunation <- array(100, null);
    CreateObject(260, 1, 201.505, -469.19, 14.0699, 255 ); // WEP OBJECT 1
    CreateObject(263, 1, 203.505, -469.19, 14.0699, 255 ); // WEP OBJECT 2
    CreateObject(266, 1, 205.505, -469.2, 14.0699, 255 ); // WEP OBJECT 3
    CreateObject(269, 1, 207.505, -469.19, 14.0699, 255 ); // WEP OBJECT 4
    ammunationcpid = CreateCheckpoint(null, 1, true, Vector(202.764, -474.561, 11.0699), RGB(0, 0, 200), 1).ID;
    print("Loaded Tooled-Up System by Sonmez")
}

function onPlayerJoin(player)
{
    ammunation[player.ID]= Ammunation()
}
function onCheckpointEntered(player,checkpoint)
{
    if (checkpoint.ID == ammunationcpid)
    {
        Announce("~r~Press ENTER", player, 0);
        ammunation[player.ID].AmmunationActive = true;
        ammunation[player.ID].wepapponscr = 949;
    }
}
function onCheckpointExited(player,checkpoint)
{
    if (checkpoint.ID == ammunationcpid)
    {
        Announce("", player, 0);
        ammunation[player.ID].AmmunationActive = false;
        ammunation[player.ID].wepapponscr = 0;
    }
}

function onKeyDown( player, key )
{
    if (ammunation[player.ID].AmmunationActive)
    {
        if (key == ArrowLeft)
        {
            switch(ammunation[player.ID].wepapponscr)
            {
                case 1:
                    player.SetCameraPos( Vector(207.363, -474.782, 13.0699), Vector(207.505, -469.957, 14.0699));
                    Announce("~r~Chainsaw 500$", player, 6);
                     Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 4;
                break;
                case 2:
                    player.SetCameraPos( Vector(201.363, -474.782, 13.0699), Vector(201.505, -469.957, 14.0699));
                    Announce("~r~Screwdriver 50$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 1;   
                break;
                case 3:
                    player.SetCameraPos( Vector(203.363, -474.782, 13.0699), Vector(203.505, -469.957, 14.0699));
                    Announce("~r~Knife 100$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 2;
                break;
                case 4:
                    player.SetCameraPos( Vector(205.363, -474.782, 13.0699), Vector(205.505, -469.957, 14.0699));
                    Announce("~r~Meat Cleaver 150$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 3;
                break;
            }
            ammunation[player.ID].wepreplcewarn = 0;
        }
        else if (key == ArrowRight)
        {
            switch(ammunation[player.ID].wepapponscr)
            {
                case 1:
                    player.SetCameraPos( Vector(203.363, -474.782, 13.0699), Vector(203.505, -469.957, 14.0699));
                    Announce("~r~Knife 100$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 2;
                break;
                case 2:
                    player.SetCameraPos( Vector(205.363, -474.782, 13.0699), Vector(205.505, -469.957, 14.0699));
                    Announce("~r~Meat Cleaver 150$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 3;
                break;
                case 3:
                    player.SetCameraPos( Vector(207.363, -474.782, 13.0699), Vector(207.505, -469.957, 14.0699));
                    Announce("~r~Chainsaw 500$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 4;
                break;
                case 4:
                    player.SetCameraPos( Vector(201.363, -474.782, 13.0699), Vector(201.505, -469.957, 14.0699));
                    Announce("~r~Screwdriver 50$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 1;
                break;
            }
            ammunation[player.ID].wepreplcewarn = 0;
        }
        else if (key == ENTER)
        {
            switch(ammunation[player.ID].wepapponscr)
            {
                case 1:
                    if (player.Cash < 50) { Announce("~r~Your money is not enough to buy this weapon", player, 6);return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 2, 1 ); player.IsFrozen = false; player.Cash -= 50;             
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 2:
                    if (player.Cash < 100) { Announce("~r~Your money is not enough to buy this weapon", player, 6); return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 5, 1 ); player.IsFrozen = false; player.Cash -= 100;
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 3:
                    if (player.Cash < 150) { Announce("~r~Your money is not enough to buy this weapon", player, 6); return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 8, 1 ); player.IsFrozen = false; player.Cash -=150; 
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 4:
                    if (player.Cash < 500) { Announce("~r~Your money is not enough to buy this weapon", player, 6);  return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 11, 1 ); player.IsFrozen = false; player.Cash -=500;
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 949:
                    player.SetCameraPos( Vector(201.363, -474.782, 13.0699), Vector(201.505, -469.957, 14.0699));
                    Announce("~r~Screwdriver 50$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    player.IsFrozen = true;
                    ammunation[player.ID].wepapponscr = 1;
                break;
            }
        }
        else if (key == ESC)
        {
            ammunation[player.ID].wepapponscr = 0;
            ammunation[player.ID].AmmunationActive = false;
            player.RestoreCamera();
            player.IsFrozen = false;
            Announce("", player, 6);
        }
        else if (key == BACKSPACE)
        {
            ammunation[player.ID].wepapponscr = 0;
            ammunation[player.ID].AmmunationActive = false;
            player.RestoreCamera();
            player.IsFrozen = false;
            Announce("", player, 6);
        }
    } 
}


Preview

if (!perfect) createAgain();

KadirYigit

  • Newbie
  • 19
  • Posts: 13
19

Sonmez

  • Jr. Member
  • Yo! It's time to play the fair game!
  • Posts: 58
if (!perfect) createAgain();

Altay

  • Newbie
  • Server Owner
  • Posts: 22
Mustafa Kemal ATATURK, the man who changed the course of history. https://en.wikipedia.org/wiki/Mustafa_Kemal_Atat%C3%BCrk

Inferno

  • Jr. Member
  • Posts: 97
Viva la VU
VFS Developer
VCCNR Administrator

« [ GameMode ] ADM Script v1.0