News A server update was released on July 20. Server patch notes and downloads are here. Additionally, a client update was released on the same day. Client patch notes are here.
Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Ali Ahmed
1
Snippet Showroom / Find random Player
« on February 13th, 10:16 AM »
The following function can help you find a random player.You can use this for minigames
Code: [Select]
function onPlayerCommand( player, cmd, text )
{
else if ( cmd == "rand" )
{
local RandPlayerID = FindRandPlayer();
print ( "Random PlayerID " + RandPlayerID );
}
}


function FindRandPlayer()
{
local
    MAX_PLAYERS = 50,
    count = 0,
    buffer = "",
    param;

    for(local i = 0; i < MAX_PLAYERS; i++)
    {
      if ( FindPlayer( i ) )
{
buffer = buffer + " " + i;
count++;
}
    }

param = split(buffer, " ");
return param[ rand() % count ];
}
2
Skin Showroom / Franklin Clinton
« on February 4th, 08:11 AM »
Content Type:Skin
Authore:GTAMAN
Modified by:Me.It was made for san andreas i converted it to vice city
link:
Pic:
3
Snippet Showroom / Bank and cash system
« on February 3rd, 07:53 AM »
Everything is explained in the code.Copy paste it correct and it will work + it is tested
Code: [Select]
function onScriptLoad( )
{
// Create/load the database
  database <- ConnectSQL( "vcmp.db" );

// Create the table
QuerySQL( database, "CREATE TABLE IF NOT EXISTS money ( nick UNIQUE COLLATE NOCASE, cash INT, bank INT)" );

// Create an array to store the money information for each online player.
MoneySlot <- array( GetMaxPlayers(), null );

print( "=== Loaded SQLite Money Example ===" );
}


// Create a base class
class money {

constructor(player, icash, ibank) {

nick  = player;
cash = icash;
bank     = ibank;
}

function load(player)
{
// Create a class instance and store the object in our array.
MoneySlot[ player.ID ] = money( player, 0, 0 );

// Check for previously saved data
if ( money.find_plr(player) )
{
local query = ::QuerySQL( database, "SELECT cash, bank FROM money WHERE nick='" + player + "'" );

      if ( ::GetSQLColumnData( query, 0 ) != null )
      {         
          // Fetch the asked values from the columns of the returned row into the array index
          MoneySlot[ player.ID ].cash = ::GetSQLColumnData( query, 0 );
          MoneySlot[ player.ID ].bank = ::GetSQLColumnData( query,1 );
}

// Ask for the next row to finalize the query result
      ::GetSQLNextRow( query );
}

// sets the player's cash in-game
player.Cash = MoneySlot[ player.ID ].cash;
}

function save(player)
{
// Grab our player data from the array
local
    plr = player.Name,
        cash = MoneySlot[ player.ID ].cash,
        bank = MoneySlot[ player.ID ].bank;

  // If player had any data in the database, update the old entry
if ( money.find_plr(player) )
{
          // Format the query string using 'format'
local query = format( "UPDATE money SET cash=%i, bank=%i WHERE nick='%s'", cash, bank, plr );

          // Then execute the query
          ::QuerySQL( database, query );
      }
     
      // Else let's just make a new entry
      else
      {
          local query = format( "INSERT INTO money (nick, cash, bank) VALUES ('%s', %i, %i)", plr, cash, bank );
          ::QuerySQL( database, query );
      }
     
      // Reset the array slot
      MoneySlot[ player.ID ] = null;
}

function SetDisplay(player)
{
// Sets the players in-game money display
player.Cash = MoneySlot[ player.ID ].cash;
}

function formatInteger(number) // by Boylett
{
    local string = "";
    local newnum = number % 1000;
    while(newnum != number)
    {
      string = format(",%03d", (newnum < 0 ? -newnum : newnum)) + string;
      number /= 1000;
      newnum = number % 1000;
    }
    string = newnum.tostring() + string;
    return "$" + string;
}

function find_plr(player)
{
local query = ::QuerySQL( database, "SELECT nick FROM money WHERE nick='" + player + "'" );
return ::GetSQLColumnData( query, 0 ) != null ? true : false;
}

nick  = null;
cash = null;
bank     = null;
}

// Derived class declaration ( A derived class inherits all members and properties of it's base )
class bank extends money {

function deposit(player, amount)
{
// Amend the 'bank' property of our class instance.
MoneySlot[ player.ID ].bank += amount;

// Subtract amount from the 'cash' value.
MoneySlot[ player.ID ].cash -= amount;

// Set players in-game money display.
money.SetDisplay(player);
}
function withdraw(player, amount)
{
// Amend the bank property value
MoneySlot[ player.ID ].bank -= amount;

// Add amount to the 'cash' value.
MoneySlot[ player.ID ].cash += amount;

// Set players in-game money display.
money.SetDisplay(player);
}
function balance(player)
{
return MoneySlot[ player.ID ].bank;
}
}

class cash extends money {

function inc(player, amount)
{
// Amend the cash property of our class instance.
MoneySlot[ player.ID ].cash += amount;

// Set players in-game money display.
money.SetDisplay(player);
}
function dec(player, amount)
{
// Amend the cash propery of our class instance.
MoneySlot[ player.ID ].cash -= amount;

// Set players in-game money display.
money.SetDisplay(player);
}
function get(player)
{
return MoneySlot[ player.ID ].cash;
}
}

/*
     ------------
       EVENTS
     ------------
*/

function onPlayerChat( player, text )
{
local backupText = text;
local firstChar = backupText.slice( 0, 1 );
if (  firstChar == "!" )
{
// The following function makes any ! commands go to the OnPlayerCommand handler
local splittext = text.slice( 1 );
local params = split( splittext, " " );
if ( params.len() == 1 ) onPlayerCommand( player, params[ 0 ], "" );
else
{
splittext = splittext.slice( splittext.find( " " ) + 1 );
onPlayerCommand( player, params[ 0 ], splittext );
}
}
}

function onPlayerJoin( player )
{
    money.load( player ); // add to login function
}

function onPlayerSpawn( player )
{
    money.load( player ); // IsLoggedIn check needed
}

function onPlayerPart( player, reason )
{
    money.save( player ); // add to logout function
}
 
function onPlayerCommand( player, command, text )
{
// Identify the player
local
            plr = text != "" ? IsNum( text ) ? FindPlayer( text.tointeger() ) : FindPlayer( text ) : player,
    arg = split( text, " " );

if ( command == "money" )
{
if ( !plr ) MessagePlayer( "Player " + text + " is not online.", player );
else
{
local cash  =  cash.get( plr );
local bank  =  bank.balance( plr );
MessagePlayer( plr.Name + "'s money:" + " Cash: " + money.formatInteger(cash) + ", Bank: " + money.formatInteger(bank), player );
}
}
else if ( command == "deposit" )
{
// var holding parameter 0 as an integer (chat-box holds it as a string)
local iarg = arg.len() > 0 ? IsNum( arg[ 0 ] ) ? arg[ 0 ].tointeger() : arg[ 0 ] : null;

if ( arg.len() == 0 ) MessagePlayer( "no params", player );
else if ( !IsNum( arg[ 0 ] ) )  MessagePlayer( "Invalid Amount!", player );
else if ( iarg > cash.get( player ) ) MessagePlayer( "You cannot deposit more than you have!", player );
else
{
bank.deposit( player, iarg );
MessagePlayer( " You Deposited " + money.formatInteger(iarg), player );
}
}
else if ( command == "withdraw" )
{
// var holding parameter 0 as an integer (chat-box holds it as a string)
local iarg = arg.len() > 0 ? IsNum( arg[ 0 ] ) ? arg[ 0 ].tointeger() : arg[ 0 ] : null;

if ( arg.len() == 0 ) MessagePlayer( "no params", player );
else if ( !IsNum( arg[ 0 ] ) )  MessagePlayer( "Invalid Amount!", player );
else if ( iarg > bank.balance( player ) ) MessagePlayer( "You cannot withdraw more than you have!", player );
else
{
bank.withdraw( player, iarg );
MessagePlayer( " You withdrew " + money.formatInteger(iarg), player );
}
}
else if ( command == "payday" )
{
cash.inc( player, 500000 ); // looking forward to driving that ferrari!!
MessagePlayer( " Pay day arrived, check your cash with !money", player );
}
}
4
Vehicle Showroom / Ferrari Fxx
« on February 3rd, 07:43 AM »
Content Type: Vehicle
Original Author: LMP-POWER
Source Link: http://www.gtainside.com/en/gta3/cars/99725-2015-ferrari-fxx-k/
Modifications:: Created XML files and converted for vcmp a little bit and created textures
Modified By: Me
Authorized By Original Author?: no i couldnt get in touch with him as he has left vc
Link for vcmp:

Image
5
Snippet Showroom / Spree System
« on February 3rd, 02:21 AM »
Everything is explained in the code.
Code: [Select]
SpreeSlot <- array( 100, null ); // Creates a static 100 size array with all values at null.

class KillingSpree {

  constructor(Player, Kills) {

PlayerName  = Player;
num_kills   = Kills;
}

function find_plr(player)
{
return SpreeSlot[ player.ID ] != null ? true : false;
}

function AnnounceSpree(text)
{
  ::Message( " **** " + text );
}

function list_players()
{
local tmp = "";
foreach ( obj in SpreeSlot )
{
if ( ( obj != null ) && ( obj.num_kills >= 5 ) )
{
tmp = tmp + obj.PlayerName + " " + obj.num_kills + ", ";
}
}

return tmp != "" ? tmp.slice(0, tmp.len() - 2) : "No Players are on a Killspree";
}

function IsSpree(killer, player, reason)
{

if ( KillingSpree.find_plr(player) )  // Spree Ended
{
// Calculate kills for the victim
local kills = SpreeSlot[ player.ID ].num_kills;

// Filter killed/died reasons
reason = reason < 39 ? "KILLED" : reason;

// Prevent spree ending for Drive-By/Vehicle killings.
if ( ( reason != 39 ) && ( reason != 42 ) )
{
// Empty the SpreeSlot.
SpreeSlot[ player.ID ] = null;

if ( kills >= 5 )
{
// Establish end type
switch ( reason )
{
case "KILLED":
AnnounceSpree( killer + " ended " + player + "'s Killing Spree of " + kills + " kills in a row." );
        break;

    case 43: AnnounceSpree( player + "'s Killing Spree was ended by drowning themselves" );
        break;

    default: AnnounceSpree( player + "'s Killing Spree was ended" );
}
}
}
}

if ( ( KillingSpree.find_plr(killer) ) || ( SpreeSlot[ killer.ID ] == null ) )
{
// Calculate kills for the killer
local kills = KillingSpree.find_plr(killer) ? SpreeSlot[ killer.ID ].num_kills + 1 : 1;

// Allocate a killing spree slot for the killer.
SpreeSlot[ killer.ID ] = KillingSpree( killer, kills );

// Establish the killspree mode.
  if ( kills == 5 ) AnnounceSpree( killer + " is on a Killing Spree with " + kills + " kills in a row!" );
  else if ( kills == 10 ) AnnounceSpree( killer + " is Dangerous!  Killing Spree with " + kills + " kills in a row!" );
  else if ( kills == 15 ) AnnounceSpree( killer + " is Murderous!!  Deadly Killing Spree with " + kills + " kills in a row!" );
  else if ( kills == 20 ) AnnounceSpree( killer + " is Psychotic!!!  Insane Killing Spree with " + kills + " kills in a row!" );
  else if ( kills == 25 ) AnnounceSpree( killer + " is an Assassin!!!!  Professional Killing Spree with " + kills + " kills in a row!" );
else if ( ( kills >= 30 ) && ( kills % 5 == 0 ) ) AnnounceSpree( killer + " is UNSTOPPABLE!!!!  Untouchable Killing Spree with " + kills + " kills in a row!" );
}
}


PlayerName = null;
num_kills  = null;
}

function onPlayerKill( killer, player, reason, bodypart )
{
  KillingSpree.IsSpree( killer, player, reason );
}

function onPlayerDeath( player, reason )
{
KillingSpree.IsSpree( null, player, reason );
}

function onPlayerPart( player, reason )
{
// Reset the spree array slot
SpreeSlot[ player.ID ] = null;
}

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "spree" ) Message( " **** " + KillingSpree.list_players() );
}
6
Snippet Showroom / Use cmds with "!"
« on February 2nd, 03:58 PM »
I couldnt  find anything like this on the forum so i made this
With this following script you can use your cmds with "!" or anything you like.This bascially sends the information typed after ! to onplayercommand and then that takes care of it and it works like a normal cmd.
Code: [Select]
local backupText = text;
    local firstletteris = backupText.slice( 0, 1 ); //slice the text
    if (  firstletteris == "!" ) //you can change the ! to anything to make it work it with that
    {
        local splitthetext = text.slice( 1 ); //now split it
        local params = split( splitthetext, " " ); //split  it further
        if ( params.len() == 1 ) onPlayerCommand( player, params[ 0 ], "" );
        else
        {                                                       //send it to function OnPlayerCommand
            splitthetext = splitthetext.slice( splitthetext.find( " " ) + 1 );
            onPlayerCommand( player, params[ 0 ], splitthetext );
return 0;
        }       
    }
7
General Discussion / Is it possible
« on January 27th, 03:23 AM »
Is it possible to add a rocket to a custom car and use it like it is used in hunter and rhino
8
Script and Content Requests / cmd not working
« on January 20th, 03:16 PM »
I made this cmd it is working but itt arrests a player even if he has no wanted level
Code: [Select]
else if (cmd == "arrest") {
if( !text ) MessagePlayer("Error - /"+cmd+" Name/id", player );
else {
local plr = text != "" ? IsNum( text ) ? FindPlayer( text.tointeger() ) : FindPlayer( text ) : player;
if( !plr )MessagePlayer("Error - Unknown player", player );
else if ( plr.WantedLevel = 0 ) return MessagePlayer( RED+" This Player is Not Wanted",player );
else if ( DistanceFromPoint( player.Pos.x, player.Pos.y , plr.Pos.x, plr.Pos.y ) < 5 ) {         //DistanceFromPoint( float x1, float y1, float x2, float y2 )
plr.Pos = Vector( 392.96, -506.26, 9.39 );
}
else MessagePlayer(""+ plr.Name +" is far away.", player );
}
}
9
Script Showroom / Pure DeathMatch Script
« on January 17th, 01:54 PM »
This is a script created by me when i was a noob so if any bugs found tell me and i Have Tested This script
Link :
10
Servers / Pakistan Theft Auto Reloaded
« on January 14th, 06:51 AM »
Hosted by:  Home hosting atleast 7 hours a day.
       Number of players slots: 100
    Scripts:  PTAR v2.0 (My own Script)
    IRC Channel:  #Not Added Yet.
Forum-- https://pta-vcmp.boards.net
Official Website-- https://ptar-vcmp.netlify.com
Specialty : A PCJ-600 parkour is being made which only will be completed only with PCJ-600 and has it's own 2 cool parkour's
11
Script and Content Requests / Save cash in database
« on January 6th, 10:44 AM »
Hi I need a function to save cash in database
please help me
12
Servers / Pakistan Theft Auto Reloaded
« on December 22nd, 2017, 03:00 PM »
Hosted by:  Home hosting atleast 7 hours a day.
       Number of players slots: 100
    Scripts:  PTAR v1.5 (My own Script)
    IRC Channel:  #Not Added Yet.
Forum-- Will be added soon.
Specialty : Has it's own cool parkour ( With the second stage under construction ).
13
Snippet Showroom / Basic Admin System
« on December 14th, 2017, 02:32 PM »
This basic admin system contains everything.You can use /admin <password> to login as admin.
This code is tested and works.It is made for a blank server.
Credits : @[VF]4L14HM3D ( it was extracted by me ) from  HERE
Place this at the top of your Script
Code: [Select]
const AdminPassword = "password" //You can edit this password
Now add this after that on the top of your Script
Code: [Select]
class PlayerInfo
{
admin = false;
}
Now add this in  function onScriptLoad( )
Code: [Select]
pinfo <- array(GetMaxPlayers(), null);
Now add this in functions.nut  ( If you dont have this add this at the last of your script )
Code: [Select]
function PlayerIsAdmin(player)
{
if(pinfo[player.ID].admin == true) return 1;
else return 0;
}
Add this in Function onPlayerJoin
Code: [Select]
pinfo[player.ID] = PlayerInfo();
Add This in function onPlayerCommand
Code: [Select]
else if (cmd == "admin")
{
if(!text) ClientMessage( "-> Error: [#ffd700]Please type /admin <admin password>", player,255,0,102);
else if ( text != AdminPassword ) ClientMessage( "-> Error: [#ffd700]Invalid PASSWORD.", player,255,0,102);
else { ClientMessage( "-> [#00ffff]Welcome admin :). You are logged as admin server.", player,255,0,102); pinfo[player.ID].admin = true; }
}
Now the commands you want to make admin commands simply add
Code: [Select]
if (!PlayerIsAdmin(player))
Example
Code: [Select]
else if ( cmd == "kick" )
    {
       if (!PlayerIsAdmin(player)) ClientMessage("-> [#ccff00]You must be an admin to use this command.", player, 255,0,102);
        else if ( !text ) ClientMessage("-> Error - Invalid Format.[#ccff00] /kick <player> <reason>", player, 255,0,102);
        else
         {
            if ( i < 2 ) ClientMessage("-> Error - Invalid Format.[#ccff00] /kick <player> <reason>", player, 255,0,102);
            else
            {
                local plrr = GetPlayer( GetTok( text, " ", 1 ) ), reason = GetTok( text, " ", 2, i );
                if ( !plrr ) PrivMessage( player,"Error - Invalid Nick/ID.");
                else if ( plrr.ID == player.ID ) PrivMessage( player,"Error - You can't /kick yourself.");
                else
                {
ClientMessageToAll( "-> [#ccff00]Admin " + player + " kicked:[ " + plr + " ] Reason:[ " + reason + " ]" ,255,0,102);                   
                    KickPlayer( plrr ); Announce( "Bye bye", plrr, 3 );
                    }
                }
            }
        }       



14
Servers / Vice City Wars | by Ali Ahmed
« on December 12th, 2017, 04:06 PM »
 IP:  Ip keeps changing it is a port foward.
Hosted by:  Home hosting atleast 3 hours a day.
       Number of players slots: 100
    Scripts:  VCW v1.5 (My own Script)
    IRC Channel:  #Not Added Yet.
Forum-- Will be added soon.
Specialty : Teleporting Camera will be added soon.