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.

Messages - KrOoB_
1
Community Plugins / Re: Calling CPP function from squirrel
« on February 24th, 06:57 AM »
this is probably not a good idea, not even an idea but have you tried to put them in to an array then return the array
2
Script Showroom / Re: Basic Inventory System for RP
« on July 16th, 2021, 12:55 AM »
Quote from husnainaligee on July 15th, 2021, 04:10 PM
every link of scripts is expire
https://dosya.co/e8z5gtfs0af7/Inventory_Blank.7z.html
try this one

*Link Updated
3
Keep
4
Tutorials / [LiveMap] Server to Website
« on January 13th, 2021, 12:29 PM »
Vice City LiveMap

Website
Install XAMPP
You need a website so you have to install XAMPP

[After Installation]
Download this and extract to X:\xampp\htdocs\ (delete everything in htdocs before)

VC:MP
Download this plugin(json) and move it to plugins folder then add the plugin's name to server.cfg
After that place this code to your main.nut (you can add more features)
Code: [Select]
function onScriptLoad()
{
  NewTimer("LiveMap", 1000, 0);
}

function LiveMap()
{
   local i = 0, ii = 0, plrveh = null, plrspec = null;
    local players = [];
    if (GetPlayers() > 0) {
        while ((i < GetMaxPlayers()) && (ii < GetPlayers())) {
            local plr = FindPlayer(i++);
            if (!plr) continue;

            if (plr.Vehicle) plrveh = {
                model = plr.Vehicle.Model,
                color = [plr.Vehicle.Colour1, plr.Vehicle.Colour2],
                health = plr.Vehicle.Health
            }
            else plrveh = null;

            players.push({
                id = plr.ID,
                name = plr.Name,
                skin = plr.Skin,
                team = plr.Team,
                hp = plr.Health,
                ap = plr.Armour,
                score = plr.Score,
                cash = plr.Cash,
                ping = plr.Ping,
                weapon = plr.Weapon,
                vehicle = plrveh,
                pos = {
                    x = plr.Pos.x,
                    y = plr.Pos.y
                },
                spawned = plr.IsSpawned,
                spectating = plrspec
            });
            ii++;
        }
    }
    local export = {
        hostname = GetServerName(),
        weather = GetWeather(),
        hour = GetHour(),
        minute = GetMinute(),
        numplayers = GetPlayers(),
        maxplayers = GetMaxPlayers(),
        players = players
    }

    try {
        toJSONFile("C:/xampp/htdocs/data.json", export, JSON_C_TO_STRING_PRETTY);
    }
    catch (e) {
        print("Export failed: " + e);
    }

}

Start the server and open your website
CREDITS
huncrys (Kristóf Bach)
Gudio
Their github link
5
Object Showroom / Re: Front Page Cafe
« on January 12th, 2021, 12:02 AM »
*UPDATE
-Added same cafe but larger

PS: Notice me if you see a bug
PS: Thanks sebastian for helping about blender cols problem
6
Object Showroom / Re: Front Page Cafe
« on January 10th, 2021, 07:46 PM »
Quote from Sebastian on January 10th, 2021, 07:03 PM
Too bad it doesn't have furniture inside
I was going to but I changed my mind and turned it to empty
I think it's good that people can decorate freely
7
Object Showroom / Front Page Cafe
« on January 10th, 2021, 05:20 PM »
Content Type: Map/Object
Original Author: Vice City
Modifications: Extracted from VC files and fixed
Modified by: KrOoB_ and ressam
Link: Normal/Large
Screenshots:


8
Snippet Showroom / Re: onPickupExited (New Custom Event)
« on January 7th, 2021, 02:19 PM »
Quote from Sebastian on January 7th, 2021, 01:36 PM
I think this is more useful for when pickup doesn't dissappear after you pick it up.
This way sonmez did makes pickup act like some sort of sphere/checkpoint
Exactly!
Quote from SHy^ on January 7th, 2021, 10:04 AM
Isn't onPickupClaimPicked(player, pickup) the function when a player exists the pickup?
when you teleport the player with a checkpoint, that function won't work.
I did a lot of tests before

@Sonmez gj mate
9
Scripting and Server Management / Re: I need vehicle Part ID
« on October 20th, 2020, 10:09 PM »
Quote from Athanatos on October 20th, 2020, 09:17 PM
Fun fact: I wrote that page, I did my research. Where's my focken credit XDDDDz *gets shot*
LOL
11
Snippet Showroom / You have the right to remain silent
« on October 2nd, 2020, 12:56 AM »
Better cuff system

Credits: KrOoB_

SERVER
Code: [Select]

class Playerstatus
{
 InJail = "false";
 JailFor = null;
 Skor = 0;
 crim = false;
 breaks = false;
}

function onScriptLoad()
{
status <- array(GetMaxPlayers(), null);
}

function onPlayerJoin( player )
{
status[player.ID] = Playerstatus();
}

function tutukla( player, plr )
{
    local player = FindPlayer(player);
    local plr = FindPlayer(plr);
    if (plr.Score > 0)
{
if( status[plr.ID].breaks == true)
{
plr.IsFrozen = false;
status[plr.ID].breaks = false;
Message("[#ac9000][VCPD] [#FFFFFF]WTF he just escaped");
Stream.StartWrite();
Stream.WriteInt(40);
Stream.SendStream(plr);
}else{
                    if(plr.Vehicle)
                        {
                            plr.Eject();
                            plr.Pos = player.Pos;
                            plr.IsFrozen = true;
                            plr.SetAnim(0,162);
                            MessagePlayer("[#ac9000][VCPD] [#FFffff]Can't escape from VCPD",plr);
                            MessagePlayer("[#ac9000][VCPD] [#FFffff]That was funny, do not try again!!",player);
                        }
                        else {
plr.Health = 100;
plr.Pos = Vector(390.863, -508.094, 9);
local Value = plr.Score; // if i write here 1 then player(criminal) stays 1 min in jail
if (Value > 6) Value = 6;
local reward = Value * 5, RealJailTime = Value * 60;
MessagePlayer("[#ac9000][VCPD] [#ffffff]Police Officer " + player.Name + " just arrest you!", plr);
                        MessagePlayer("[#ac9000][VCPD][#ffffff]Got Medical attention", plr);
Message("[#ac9000][VCPD] [#FFFFFF]Police Officer " + player.Name + " just arrest a criminal named " + plr.Name + " . Duration:" + Value + " Min");
IncCash(player, reward); // u can find this function in forum
plr.Skin = 7;
plr.Disarm();
status[ plr.ID ].JailFor = RealJailTime;
Stream.StartWrite( );
Stream.WriteInt( 33 );
Stream.SendStream( plr );
                        if(plr.IsFrozen == true) plr.IsFrozen = false;
Stream.StartWrite();
Stream.WriteInt(40);
Stream.SendStream(player);                       
}
        }
}
}

function onTimeChange(oldHour, oldMin, newHour, newMin)
{
for (local i = 0; i < GetMaxPlayers(); ++i)
{
local player = FindPlayer(i);

if (player)
{
if (player.IsSpawned)
{
if ( status[player.ID].JailFor != null )
{
if (status[player.ID].InJail == "true" && status[player.ID].JailFor > 0)
{
local Time = status[player.ID].JailFor,
mins = (Time % 3600) / 60,
secs = Time % 60;
Stream.StartWrite();
Stream.WriteInt(35);
Stream.WriteString(mins + ":" + secs);
Stream.SendStream(player);
status[player.ID].JailFor--;
local polyarest;
polyarest = InPoly( player.Pos.x, player.Pos.y, 411.836, -482.679, 286.270, -467.721, 350.046, -482.532, 391.226, -522.587);
if( !polyarest && status[player.ID].InJail == "true" ) player.Pos = Vector(390.863, -508.094, 9);
}
else if (status[player.ID].JailFor < 1)
{
Stream.StartWrite();
Stream.WriteInt(34);
Stream.SendStream(player);
                        player.Score = 0;
                       
}
}
}
        }
    }
}
 function onPlayerCommand( player, cmd, text )
{
if (cmd == "tutukla" || cmd == "t")
{
if (!text) MessagePlayer("Error - /" + cmd + " [Name/id]", player);
else
{
local plr = text != "" ? IsNum(text) ? FindPlayer(text.tointeger()) : FindPlayer(text) : player;
if (!plr) MessagePlayer("[#ac9000][VCPD] Unkown Player", player);
else if (status[plr.ID].InJail == "true") MessagePlayer("[#ac9000][VCPD] He's already in jail bruh", player)
else if (plr.Name == player.Name) MessagePlayer("[#ac9000][VCPD] Trying to cuff himself kekW", player)
else if (DistanceFromPoint(player.Pos.x, player.Pos.y, plr.Pos.x, plr.Pos.y) < 2)
{
      status[plr.ID].crim = true;
                      Stream.StartWrite();
Stream.WriteInt(38);
Stream.SendStream(plr);
                        plr.IsFrozen = true;
                        hapiss <- NewTimer("tutukla",5000,1,player.ID,plr.ID);

}
else MessagePlayer("[#ac9000][VCPD] [#FFFFFF]Away",player)
}
}
}
function onClientScriptData( player )
{
local int = Stream.ReadInt( ),
string = Stream.ReadString ( );
  switch( int.tointeger() )
{
case 3:
if( status[player.ID].breaks == false)
{
status[player.ID].breaks = true;
}
break;
}
}



CLIENT
Code: [Select]
ask<-KeyBind(0x4B);

Cuff<-
{
    Window = null
    tBar = null
    stat = 0
}


function Server::ServerData(stream)
{
 local StreamReadInt = stream.ReadInt(),
 StreamReadString = stream.ReadString();
 switch (StreamReadInt.tointeger())
 {
case 38: Criminal( ); break;
case 40: DeCrim(); break;
 }
}

function KeyBind::OnDown( key )
{
if( key == ask)
{
if ( Cuff.Window)
{
if ( Cuff.stat > 0)
{
if ( Cuff.tBar.Value == 6 || Cuff.tBar.Value == 7 || Cuff.tBar.Value == 8 || Cuff.tBar.Value == 9 || Cuff.tBar.Value == 10 )
{
local Data = Stream();
Data.WriteInt(3);
Server.SendData(Data);
}else
  {
Cuff.Window = null;
Cuff.tBar = null;
Cuff.stat = 0;
Console.Print("[#FFFFFF]Unsuccessful");
  }
}
}
}
}

// bad code sorry  :(
function Script::ScriptProcess( )
{
if (Cuff.Window)
{
if( Cuff.stat == 1 )
{
Cuff.tBar.Value += 1;
}
else if ( Cuff.tBar.Value == 15 )
{
Cuff.stat = 2;
}
else if( Cuff.stat == 2 )
{
Cuff.tBar.Value -= 1;
}
else if( Cuff.stat == 2 && Cuff.tBar.Value == 0 )
{
Cuff.stat = 1;
}
durduran <- Timer.Create( this, DeCrim, 2000, 1);
}
}

function Criminal( )
 {
    Cuff.Window = GUIWindow(VectorScreen(sX * 0.35, sY * 0.75), VectorScreen(sX * 0.4, sY * 0.123), Colour(20, 20, 20, 200), "DECUFF", GUI_FLAG_TEXT_TAGS);
    Cuff.Window.AddFlags(GUI_FLAG_VISIBLE);
    Cuff.Window.RemoveFlags(GUI_FLAG_DRAGGABLE | GUI_FLAG_WINDOW_CLOSEBTN | GUI_FLAG_WINDOW_RESIZABLE);

    Cuff.tBar = GUIProgressBar();
    Cuff.tBar.Pos = VectorScreen(sX * 0.005, sY * 0.0015);
    Cuff.tBar.Size = VectorScreen( sX * 0.39, sY * 0.064 );
    Cuff.tBar.StartColour = Colour( 40, 255, 40 );
    Cuff.tBar.EndColour = Colour( 180, 110, 110 );
    Cuff.tBar.MaxValue = 15;
    Cuff.tBar.Value = 0;
    Cuff.tBar.BackgroundShade = 0.3;
    Cuff.tBar.Thickness = 2;
    Cuff.stat = 1;
    Cuff.Window.AddChild(Cuff.tBar);
 }

 function DeCrim()
{
Cuff.Window = null;
Cuff.tBar = null;
Cuff.stat = 0;
}


12
Vehicle Showroom / Fixed McLaren
« on October 1st, 2020, 10:44 PM »
Official Author and Link: Jarone
Modifications: There was a collision bug 'til this day :D
Modified By: KrOoB_

File:
https://www92.zippyshare.com/v/LZUgkfJs/file.html
13
Snippet Showroom / Need some Nos ?
« on October 1st, 2020, 10:30 PM »
INFORMATION
It's a basic nos script :D

Credits
KrOoB_

Code
Code: [Select]
class nos{
basili = false;
sure = 10; // nos amount/second
durum = false;
}

function onScriptLoad()
{
turbo <- array(GetMaxPlayers(), null);
CTRL <- BindKey(true, 0x11, 0, 0);
}



// u can use timers if u wish
function onTimeChange(oldHour, oldMin, newHour, newMin)
{
for (local i = 0; i < GetMaxPlayers(); ++i)
{
local player = FindPlayer(i);
if (player)
{
if (player.IsSpawned)
{
if ( turbo[ player.ID ].basili == true)
{
if ( turbo[ player.ID ].durum == true)
{
if ( turbo[ player.ID ].sure > 0 )
{
turbo[ player.ID ].sure -= 1;
}else {
local veh = player.Vehicle;
turbo[ player.ID ].sure = 0;
veh.ResetHandlingData(13);
veh.ResetHandlingData(14);
MessagePlayer("Vehicle's nos tube is empty get a new one",player);
}
}
}
}
}
}
}



function onKeyDown( player, key )
{
if ( key == CTRL )
{
if ( player.Vehicle )
{
turbo[ player.ID ].basili = true;
if ( turbo[ player.ID ].sure > 0 )
{
local veh = player.Vehicle;
veh.Lights = true;
turbo[ player.ID ].durum = true;
veh.SetHandlingData(14, 100)
veh.SetHandlingData(13, 1000)
}else return MessagePlayer("Empty",player);
}
}
}

function onKeyUp( player, key )
{
if ( key == CTRL )
{
if ( player.Vehicle )
{
local veh = player.Vehicle;
veh.Lights = false;
turbo[ player.ID ].basili = false;
veh.ResetHandlingData(13);
veh.ResetHandlingData(14);
}
}
}
14
Community Plugins / Re: Discord Plugin
« on September 30th, 2020, 09:13 PM »
how can i select/detect someone in voice channel ?
15
Snippet Showroom / No need to die
« on September 30th, 2020, 07:53 PM »
INFORMATION
Normally when a player dies game sends player to character selection part, with this script there'll no character selection.
When a player dies script'll freeze and sets hp to 1, script waits 1 min for doctors (i add a function for doctors u can use it, named kaldir) (After 1 min script sends player to nearest hospital)

Credits
 KrOoB_ and Bob
(this script works with bob's script add it too)
Thanks Bob, Send Player to Nearest Hospital

Server Side
Code: [Select]
class Playerstatus
{
 Died = false;
 d_X = null;
 d_Y = null;
 d_Z = null;
 DeadFor = null;
}


function onScriptLoad()
{
    acilarr <- array(GetMaxPlayers(), false);

status <- array(GetMaxPlayers(), null)
// You can edit SQL code it's just an example
        DB <- ConnectSQL("Databases/Hesap.db");
        QuerySQL(DB, "create table if not exists Other ( Name TEXT, Died BOOLEAN DEFAULT false, DX FLOAT, DY FLOAT, DZ FLOAT) ");
}

function onPlayerJoin( player )
{
status[player.ID] = Playerstatus();
DeadInfo(player);
}

function aciloff(player)
{
    player = FindPlayer( player );
    DestroyMarker( acils );
    acilarr[player.ID] = false;
}

function DeadInfo(player)
{
 local z = QuerySQL(DB, "SELECT * FROM Other WHERE Name = '" + escapeSQLString(player.Name) + "'");
 if (q)
 {
  status[player.ID].Died = GetSQLColumnData(z, 7);
  status[player.ID].d_X = GetSQLColumnData(z, 8);
  status[player.ID].d_Y = GetSQLColumnData(z, 9);
  status[player.ID].d_Z = GetSQLColumnData(z, 10);
 }
}
function onPlayerDeath( player, reason )
{
        player.Health = 1;
        status[player.ID].d_X = player.Pos.x;
        status[player.ID].d_Y = player.Pos.y;
        status[player.ID].d_Z = player.Pos.z;   
        status[player.ID].Died = true;

if ( status[player.ID].Died == true)
{
            // Emergency Call

 local acilci;
 for( local i = 0; i <= GetMaxPlayers(); i++ )
 {
 acilci = FindPlayer( i );
 if ( (acilci) && ( acilci.Skin == 1 ) )
 {
                Message("[#1b8bb4][EMERGENCY] [#FFFFFF]" + player.Name + " [#1b8bb4] needs medical attention. [#1b8bb4] Position:[#FFFFFF] " +GetDistrictName(player.Pos.x, player.Pos.y)+"")
                MessagePlayer("[#1b8bb4][EMERGENCY] [#FFFFFF]Doctors are called. [#1b8bb4] Position:[#FFFFFF] " +GetDistrictName(player.Pos.x, player.Pos.y)+"",player)   
     acils <- CreateMarker(1, Vector(player.Pos.x, player.Pos.y, player.Pos.z), 1, RGB(0, 255, 0), 22)
    NewTimer("aciloff", 30000, 1, player.ID);
    acilarr[player.ID] = true;
 }
    }
        player.SetAnim(0,126);
        player.IsFrozen = true;
    }
}

function onPlayerKill( killer, player, reason, bodypart )
{
    player.Health = 1;
    status[player.ID].Died = true;
    if ( status[player.ID].Died == true)
    {
            // Emergency Call
local acilci;
for( local i = 0; i <= GetMaxPlayers(); i++ )
{
acilci = FindPlayer( i );
if ( (acilci) && ( acilci.Skin == 1 ) )
{
                Message("[#1b8bb4][EMERGENCY] [#FFFFFF]" + player.Name + " [#1b8bb4] needs medical attention. [#1b8bb4] Position:[#FFFFFF] " +GetDistrictName(player.Pos.x, player.Pos.y)+"")
                MessagePlayer("[#1b8bb4][EMERGENCY] [#FFFFFF]Doctors are called. [#1b8bb4] Position:[#FFFFFF] " +GetDistrictName(player.Pos.x, player.Pos.y)+"",player)   
acils <- CreateMarker(1, Vector(player.Pos.x, player.Pos.y, player.Pos.z), 1, RGB(0, 255, 0), 22)
NewTimer("aciloff", 30000, 1, player.ID);
acilarr[player.ID] = true;
}
}
        player.SetAnim(0,126);
        player.IsFrozen = true;
    }
}

function onTimeChange(oldHour, oldMin, newHour, newMin)
{
for (local i = 0; i < GetMaxPlayers(); ++i)
{
local player = FindPlayer(i);

if (player)
{
if (player.IsSpawned)
{
            if ( status[player.ID].Died == true)
            {
                if (status[player.ID].DeadFor == null)
                {
                    // Calculating time
                        local Val = 1;
                        local DeadJail = Val * 10000, DeadJail2 = Val * 10;
                        status[player.ID].DeadFor = DeadJail2;
                }else {

                    local Time = status[player.ID].DeadFor,
mins = (Time % 3600) / 60,
secs = Time % 60;
Stream.StartWrite();
Stream.WriteInt(36);
Stream.WriteString(mins + ":" + secs);
Stream.SendStream(player);
status[player.ID].DeadFor--;
                }
if ( status[player.ID].DeadFor < 1)
{
if( Hospi[player.ID] == 1 )
{
GetNearestHospital(player);
player.World = 1;
                            // En yakın Hastane Scripti entegresi adamın süresi dolunca en yakın hastaneye gider
if (Hospital_Spawn[player.ID] == true) { player.Pos = Hospital_Locator[player.ID]; Hospital_Spawn[player.ID] = false; }
Hospi[player.ID] = 0;
MessagePlayer( "[#e74c3c][EMERGENCY] [#FFFFFF]Revived.", player );
Stream.StartWrite();
Stream.WriteInt(37);
Stream.SendStream(player);
status[player.ID].DeadFor = null;
status[player.ID].Died = false;
player.IsFrozen = false;
player.SetAnim(0,172);
}
    }
                }
            }
        }
    }
}
function onPlayerSpawn( player )
{
    if ( status[player.ID].Died == true)
    {
Hospi[player.ID] = 1;
        player.SetAnim(0,126);
        player.IsFrozen = true;
        player.Pos = Vector(status[player.ID].d_X,status[player.ID].d_Y,status[player.ID].d_Z);
        // i'm saving player's pos cause of dead bug like explode etc.
        // if player's death cause is explode, game sends player directly character selection
        local acilci;
        for( local i = 0; i <= GetMaxPlayers(); i++ )
        {
            acilci = FindPlayer( i );
            if ( (acilci) && ( acilci.Skin == 1 ) )
            {
                Message("[#1b8bb4][EMERGENCY] [#FFFFFF]" + player.Name + " [#1b8bb4] needs medical attention. [#1b8bb4] Position:[#FFFFFF] " +GetDistrictName(player.Pos.x, player.Pos.y)+"")
                MessagePlayer("[#1b8bb4][EMERGENCY] [#FFFFFF]Doctors are called. [#1b8bb4] Position:[#FFFFFF] " +GetDistrictName(player.Pos.x, player.Pos.y)+"",player)   
                acils <- CreateMarker(1, Vector(player.Pos.x, player.Pos.y, player.Pos.z), 1, RGB(0, 255, 0), 22)
                NewTimer("aciloff", 30000, 1, player.ID);
                acilarr[player.ID] = true;
            }
        }
    }
}

// function for doctors' command to revive dead/injured player
function kaldir( p )
{

 local player = FindPlayer( p );
 if( player )
    {
        player.IsFrozen = false;
        player.SetAnim(0,161);
        status[player.ID].Died = "false";
        MessagePlayer("[#ef5777]#[#0be881]VC[#d2dae2]-[#575fcf]TR[#ef5777]# [#828282]Tedavin bitti", player);
    }
Stream.StartWrite();
Stream.WriteInt(37);
Stream.SendStream(player);
status[player.ID].DeadFor = null;
}
function SaveAccount(player)
{
          QuerySQL(DB, "UPDATE Other SET Died = '" + status[player.ID].Died + "' WHERE Name = '" + player.Name + "'");
          QuerySQL(DB, "UPDATE Other SET DX = '" + status[player.ID].d_X + "' WHERE Name = '" + player.Name + "'");
          QuerySQL(DB, "UPDATE Other SET DY = '" + status[player.ID].d_Y + "' WHERE Name = '" + player.Name + "'");
          QuerySQL(DB, "UPDATE Other SET DZ = '" + status[player.ID].d_Z + "' WHERE Name = '" + player.Name + "'");
}



Client Side
Code: [Select]

Dead <-
    {
    Windows = null
    Labels = null
        Time = null
    }

function Server::ServerData(stream)
{
 local StreamReadInt = stream.ReadInt(),
 StreamReadString = stream.ReadString();
 switch (StreamReadInt.tointeger())
 {
case 36: local data = StreamReadString; DeadFors(data); break;
case 37: Dead.Labels = null; break;
 }
 }

  function DeadFors(data)
    {
    local separator = split(data ":"), mins = separator[0], secs = separator[1];
    Dead.Labels = GUILabel(VectorScreen(sX * 0.5, sY * 0.8), Colour(232, 232, 232), "", GUI_FLAG_TEXT_SHADOW | GUI_FFLAG_BOLD);
Dead.Labels.FontSize = 15;
    Dead.Labels.Text = "" + mins + " min " + secs + " sec";
    }
function DeadForN()
    {
    Dead.Labels = null;
    }


VIDEO
Note: I'm using it in my server no bug or error.(while extracting from server script i might be miss something, just in case u can tell thanks)