Recent posts

#1
Scripting and Server Management / Re: How to unload scripts?
Last post by PSL - Mar 24, 2024, 02:38 PM
I'm looking into this plugin: https://forum.vc-mp.org/index.php?topic=9181.0
I'll publish the results within 90 days.
#2
Off-Topic General / Asian City Triple Clash - ACTC...
Last post by Broly. - Mar 24, 2024, 08:07 AM
🎉🌟 Attention VCMP Clan Members! You're Invited to the Asian City Triple Clash - ACTC Event! 🌟🎉

How it Works:
Join our AC discord: https://discord.gg/4geCusrX


Gather your team of 3 or 4, including the captain.
Copy and fill out the format in the ⁠team-applications board.
Interested in becoming a referee? Copy and fill out the format in the ⁠referee-applications  board.
Each team can have 4 players (including the captain), with 3 players playing and 1 player as a sub.


Prizes:
Winning Team:15USD Dollars, $2M, a Hydra, and a Ferrari vehicle.

Runner-up Team: $1M and an Infernus Vehicle.

Match Hosting:
Format: 3 vs 3.
Limited weapons during matches.
Each match consists of 3 rounds, each lasting 15 minutes.
Scoring: Each kill earns 1 point, while spree will give you +3 score.

Server IP : 162.19.27.237:8192

Last Date to Apply : 27/03/2024
For more Info you can Check

ACTC-information


#3
Script Showroom / Re: BindKey Process System
Last post by PSL - Mar 24, 2024, 12:45 AM
I updated the function to set the number of repetitions, Make adding code easier.
AddKeyToTable(Key_K,10); //When K is pressed, it is automatically executed 10 times.
Create nut to scripts folder gift, name is keyprocess.nut.

//by: https://forum.vc-mp.org/index.php?topic=9397.0
//Function
/*
AddKeyToTable(key); //Set a key to repeat
AddKeyToTable(key,processtimes); //Set the key to repeat and set the number of repetitions
DeleteKeyToTable(key); //Delete the duplicate function of the key
SetKeyExecTime(time); //Set the interval for automatic execution
*/

function LoadKeyProcess()
{
ProcessKey<-{}; //Records repeatable keys
ProcessKeyTime<-10; //Execution interval milliseconds
ProcessKeyTimer<-null; //Execute key timer

PlayerKeys<-{}; //Record the keys pressed by the player

ProcessKeyExecTimes<-{}; //Records the number of key executions
PlayerKeyExecTimes<-array(100,null); //Record the number of times a player executes each key
}

function AddKeyToTable(key,processtimes=null)
{
ProcessKey.rawset(key,key);
if(processtimes!=null) ProcessKeyExecTimes.rawset(key,processtimes);
}

function DeleteKeyToTable(key)
{
if(ProcessKey.rawin(key)) ProcessKey.rawdelete(key);
if(ProcessKeyExecTimes.rawin(key)) ProcessKeyExecTimes.rawdelete(key);
}

function SetKeyExecTime(times)
{
if(times<0) times=1;
ProcessKeyTime=times;
}

function AddPlayerKeyToTable(i,key)
{
local plr=FindPlayer(i);
if(plr)
{
if(ProcessKey.rawin(key))
{
if(PlayerKeys.rawin(plr.ID))
{
local arr=PlayerKeys.rawget(plr.ID),find=false;
for(i=0;i<arr.len();i++)
{
if(arr[i]==key)
{
find=true;
break;
}
}
if(find==false) arr.append(key);
}
else
{
local arr=[];
arr.append(key);
PlayerKeys.rawset(plr.ID,arr);
}

if(ProcessKeyExecTimes.rawin(key))
{
if(PlayerKeyExecTimes[plr.ID]==null) PlayerKeyExecTimes[plr.ID]={};
if(PlayerKeyExecTimes[plr.ID].rawin(key))
{
local times=PlayerKeyExecTimes[plr.ID].rawget(key);
times-=1;
PlayerKeyExecTimes[plr.ID].rawset(key,times);
}
else
{
local keytimes=ProcessKeyExecTimes.rawget(key);
PlayerKeyExecTimes[plr.ID].rawset(key,keytimes);
}
}
CreateProcessKeyTimer();
}
}
}

function DeletePlayerKeyToTable(i,key)
{
local plr=FindPlayer(i);
if(plr)
{
if(ProcessKey.rawin(key))
{
if(PlayerKeys.rawin(plr.ID))
{
local arr=PlayerKeys.rawget(plr.ID);
for(local i=0;i<arr.len();i++)
{
if(arr[i]==key)
{
arr.remove(i);
break;
}
}
if(arr.len()==0) PlayerKeys.rawdelete(plr.ID);
}
if(ProcessKeyExecTimes.rawin(key))
{
if(PlayerKeyExecTimes[plr.ID]!=null)
{
if(PlayerKeyExecTimes[plr.ID].rawin(key))
{
PlayerKeyExecTimes[plr.ID].rawdelete(key);
if(PlayerKeyExecTimes[plr.ID].len()==0) PlayerKeyExecTimes[plr.ID]=null;
}
}
}
if(PlayerKeys.len()==0) DeleteProcessKeyTimer();
}
}
}

function DeleteAllPlayerKeyToTable(i)
{
local plr=FindPlayer(i);
if(plr)
{
if(PlayerKeys.rawin(plr.ID)) PlayerKeys.rawdelete(plr.ID);
if(PlayerKeyExecTimes[plr.ID]!=null) PlayerKeyExecTimes[plr.ID]=null;
}
}

function CreateProcessKeyTimer()
{
if(ProcessKeyTimer==null) ProcessKeyTimer=NewTimer("onServerKeyProcess",ProcessKeyTime,0);
}

function DeleteProcessKeyTimer()
{
if(ProcessKeyTimer!=null) ProcessKeyTimer.Delete();
ProcessKeyTimer=null;
}

function onServerKeyProcess()
{
for(local i=0;i<100;i++)
{
local plr=FindPlayer(i);
if(plr)
{
if(PlayerKeys.rawin(plr.ID))
{
local arr=PlayerKeys.rawget(plr.ID);
for(local i=0;i<arr.len();i++)
{
local find=false;
if(ProcessKeyExecTimes.rawin(arr[i]))
{
if(PlayerKeyExecTimes[plr.ID]!=null)
{
if(PlayerKeyExecTimes[plr.ID].rawin(arr[i]))
{
local keytimes=PlayerKeyExecTimes[plr.ID].rawget(arr[i]);
if(keytimes<0) find=true;
}
}
}
if(find==false) onKeyDown(plr,arr[i]);
}
}
}
}
}

LoadKeyProcess();

Add in main.nut
function onScriptLoad()
{
dofile("scripts/keyprocess.nut");
}
function onPlayerPart(player,reason)
{
DeleteAllPlayerKeyToTable(player.ID);
}
function onKeyDown(player,key)
{
AddPlayerKeyToTable(player.ID,key);
}
function onKeyUp(player,key)
{
DeletePlayerKeyToTable(player.ID,key);
}

Very simple way to add. You can customize the key Settings according to the previous code.
#4
Script Showroom / Re: Ammunation Ready!
Last post by Abbas_905 - Mar 20, 2024, 08:01 AM
pro
#5
Script Showroom / Transferstats Command
Last post by Abbas_905 - Mar 20, 2024, 04:08 AM
else if ( cmd == "transferstats" )
{
       if ( !text ) MessagePlayer("Error: Please use the correct syntax.  /transferstats <newnick>.", player );
       else
       {
       local newnick = text,
       pn = QuerySQL(sqliteDB, " SELECT Name FROM Accounts WHERE Name='"+player.Name+"' "),
       n = QuerySQL(sqliteDB, " SELECT Name FROM Accounts WHERE Name='"+newnick+"' "),
       aldname = GetSQLColumnData(n, 0),
       oldname = GetSQLColumnData(pn, 0);
       if ( newnick == player.Name ){
       MessagePlayer("Error: Your new name cannot be the same nickname.",player); return false;}
       else if ( aldname != null ) { MessagePlayer("Error:This name is already registered by someone.",player); return false;}
else
{
QuerySQL(sqliteDB, "UPDATE Accounts SET Name='"+newnick+"', NameLower='"+newnick.tolower() +"'  WHERE Name='"+oldname+"' ");
         QuerySQL(Spawnweps, "UPDATE SpawnWep SET Name='"+newnick+"' WHERE Name='"+oldname+"' ");
         QuerySQL(SpawnLoc, "UPDATE Spawnloc SET player='"+newnick+"' WHERE player='"+oldname+"'");
         player.Name=text;
         MessagePlayer("Successfully changed your nickname to " + newnick  +"!",player);
         }
         FreeSQLQuery( pn );
         FreeSQLQuery( n );
         }
         }
#6
Script Showroom / Re: Dipeos command
Last post by Abbas_905 - Mar 19, 2024, 03:50 PM
Bro so now u and some others gived me functions not diepos command u can give me?  :(
#7
Script Showroom / Re: BindKey Process System
Last post by Mohamed Boubekri - Mar 18, 2024, 10:22 AM
Setting the time during a key press is a very useful feature to prevent occasional hacking or delays in some scripts.
good job.
#8
Script Showroom / Re: Dipeos command
Last post by PSL - Mar 16, 2024, 08:45 AM
This script has no language formatting errors.
#9
Script Showroom / Re: BindKey Process System
Last post by PSL - Mar 16, 2024, 08:35 AM
I've optimized the script to make it easier to add methods, use only one timer, and be more efficient. Adapt the following code to your server.
function onScriptLoad()
{
    PlayerKeys<-{};
    ProcessKey<-{};
    ProcessKeyTime<-100; //This number sets the speed of the code
    ProcessKeyTimer<-null;
}
function onPlayerPart(player,reason)
{
    DeleteAllPlayerKeyToTable(player.ID);
}
function onKeyDown(player,key)
{
    AddPlayerKeyToTable(player.ID,key);
}
function onKeyUp(player,key)
{
    DeletePlayerKeyToTable(player.ID,key);
}

//Functions
function AddKeyToTable(key)
{
    ProcessKey.rawset(key,key);
}
function DeleteKeyToTable(key)
{
    if(ProcessKey.rawin(key)) ProcessKey.rawdelete(key);
}
function AddPlayerKeyToTable(i,key)
{
    local plr=FindPlayer(i);
    if(plr)
    {
        if(ProcessKey.rawin(key))
        {
            if(PlayerKeys.rawin(plr.ID))
            {
                local arr=PlayerKeys.rawget(plr.ID),find=false;
                for(i=0;i<arr.len();i++)
                {
                    if(arr[i]==key)
                    {
                        find=true;
                        break;
                    }
                }
                if(find==false) arr.append(key);
            }
            else
            {
                local arr=[];
                arr.append(key);
                PlayerKeys.rawset(plr.ID,arr);
            }
            CreateProcessKeyTimer();
        }
    }
}
function DeletePlayerKeyToTable(i,key)
{
    local plr=FindPlayer(i);
    if(plr)
    {
        if(ProcessKey.rawin(key))
        {
            if(PlayerKeys.rawin(plr.ID))
            {
                local arr=PlayerKeys.rawget(plr.ID);
                for(local i=0;i<arr.len();i++)
                {
                    if(arr[i]==key)
                    {
                        arr.remove(i);
                        break;
                    }
                }
                if(arr.len()==0) PlayerKeys.rawdelete(plr.ID);
            }
            if(PlayerKeys.len()==0) DeleteProcessKeyTimer();
        }
    }
}
function DeleteAllPlayerKeyToTable(i)
{
    local plr=FindPlayer(i);
    if(plr)
    {
        if(PlayerKeys.rawin(plr.ID)) PlayerKeys.rawdelete(plr.ID);
    }
}
function CreateProcessKeyTimer()
{
    if(ProcessKeyTimer==null) ProcessKeyTimer=NewTimer("onServerKeyProcess",ProcessKeyTime,0);
}
function DeleteProcessKeyTimer()
{
    if(ProcessKeyTimer!=null) ProcessKeyTimer.Delete();
    ProcessKeyTimer=null;
}
function onServerKeyProcess()
{
    for(local i=0;i<100;i++)
    {
        local plr=FindPlayer(i);
        if(plr)
        {
            if(PlayerKeys.rawin(plr.ID))
            {
                local arr=PlayerKeys.rawget(plr.ID);
                for(local i=0;i<arr.len();i++) onKeyDown(plr,arr[i]);
            }
        }
    }
}

test code: A simple fly code, I key up, K key down. The above code must be installed first.
function onScriptLoad()
{
    Key_J<-BindKey(true,0x4A,0,0);
    Key_L<-BindKey(true,0x4C,0,0);
    Key_I<-BindKey(true,0x49,0,0);
    Key_K<-BindKey(true,0x4B,0,0);
   
    AddKeyToTable(Key_I); //Adds the binding key to the table that is looped
    AddKeyToTable(Key_K);

    ProcessKeyTime=10;
}
function onKeyDown(player,key)
{
    if(key==Key_I) player.Pos.z+=1;
    if(key==Key_K) player.Pos.z-=1;
    if(key==Key_J) MessagePlayer("[#FFFF00]Key: J",player);
    if(key==Key_L) MessagePlayer("[#FFFF00]Key: L",player);
}
#10
Script Showroom / Re: Ban & echo,system
Last post by Abbas_905 - Mar 14, 2024, 12:28 AM
bro oh so thank you for you have discord?