Menu

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.

Show posts Menu

Messages - Milos

#16
Snippet Showroom / Top Killers System
Mar 11, 2019, 04:20 PM

And I created a Top Killer system without using database every time it is called:

Create a table:
Accounts <- {}; /* Table where accounts will be */
Functions:
/* Let's say we are loading the accounts from the database */
function loadAccounts() {
    //9 "accounts"
    Accounts.rawset(1, {Name = "Player1", Kills = rand() % 1000});
    Accounts.rawset(2, {Name = "Player2", Kills = rand() % 1000});
    Accounts.rawset(3, {Name = "Player3", Kills = rand() % 1000});
    Accounts.rawset(4, {Name = "Player4", Kills = rand() % 1000});
    Accounts.rawset(5, {Name = "Player5", Kills = rand() % 1000});
    Accounts.rawset(6, {Name = "Player6", Kills = rand() % 1000});
    Accounts.rawset(7, {Name = "Player7", Kills = rand() % 1000});
    Accounts.rawset(8, {Name = "Player8", Kills = rand() % 1000});
    Accounts.rawset(9, {Name = "Player9", Kills = rand() % 1000});
/* NOTE: You will have to adapt this function to load all the accounts of your database. */
}

function topKills() {
    /*Here, we will temporarily clone the original table, because we will
      have to delete some data (and we do not want this to happen in the main table)*/
    local backup_Accounts = clone Accounts;
 
    local limit = 5, tmp = "";
    while (limit) {
        local topScore = 0, index = 0;
        foreach (i, v in backup_Accounts)
        {
            if (backup_Accounts[i]["Kills"] > topScore) {
                topScore = backup_Accounts[i]["Kills"];
                index = i;
            }
        }
        if (index) tmp = tmp + backup_Accounts[index]["Name"] + " - " + backup_Accounts[index]["Kills"] + ", ";
        backup_Accounts.rawdelete(index);
        limit --;
    }
    return tmp != "" ? tmp.slice(0, tmp.len() - 2) : "No top killers";
}
 
function getAccountID(str) {
    foreach (i, v in Accounts) {
        if (Accounts[i]["Name"].tolower() == str.tolower()) {
            return i;
            break;
        }
    }
    return 0;
}

Server Events:
function onScriptLoad() {
    loadAccounts();
    print(topKills());
}
 
function onPlayerKill(killer, player, reason, bodypart) {
    /* Do not forget to update the amount of kills when the player scores */
    local i = getAccountID(killer.Name);
    if (i) Accounts[i]["Kills"] ++;
}

Result:


My server:


* I do not know why it always starts with the same values, even using the rand(), but you can change each kill in the loadAccounts function to confirm the script's operation (Someone explains to me)

#17
I think that would be very interesting.
Can anyone tell me if this is included in the TODO list?

#18
Community Plugins / Re: Discord Plugin
Mar 08, 2019, 03:21 AM
Quote from: Luckshya on Mar 08, 2019, 02:46 AM
Quote from: Pau Grosso on Mar 07, 2019, 11:55 PMHow useful is the authorNick if author already does this?
It returns nothing
The authorNick param returns empty string if a user doesn't have any nickname set on discord.
It also returns null if a DM is received.

So, does 'Sprunk' has his nickname set in the bot's discord server?
Oh now I understand. and no, it has no nickname on server ;D
Thanks
#19
Community Plugins / Re: Discord Plugin
Mar 07, 2019, 11:55 PM
Quote from: Luckshya on Mar 06, 2019, 08:54 AMA new update 0.2 has been released that brings the following changes.
  • Fixed an issue that causes server to crash when a DM is received by the bot.
  • Added param authorID to the event onDiscord_Message as updated in the example code.

Make sure you update the binaries from the latest release on the repo.
How useful is the authorNick if author already does this?
It returns nothing
#20
Community Plugins / Re: Discord Plugin
Mar 05, 2019, 09:58 PM
Very good, thanks for that.
Doubt: any way to get the level of channel users?
Report: When the bot receives a private message it crashes the server.
#23
Quote from: =RK=MarineForce on Sep 04, 2018, 07:16 PMPOP360 i want change camerapos when i change skin . its bugged.
What happens is that the configuration is done after changing the skin. I think that's it.
Try this:
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions/Player.SetCameraPos
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions/Player.Pos
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions/Player.Angle

Quote from: =RK=MarineForce on Sep 04, 2018, 07:16 PMbro when i type /away i will be afk?
No, this happens automatically when the player minimizes the game or by pressing ESC (I'm not sure).
#24
Quote from: =RK=MarineForce on Sep 04, 2018, 09:45 AMfunction onPlayerRequestClass( player, classID, team, skin )
{
switch( skin )
    {
    case 83:
    {
SetSpawnPlayerPos(-1168, -617.437, 12.7852);
SetSpawnCameraPos( -1170.91, -617.551, 11.8277 );
SetSpawnCameraLook( -1170.91, -617.551, 11.8277 );
 player.PlaySound( 50001);
player.SetAnim(0,157);
 Announce( "Cuban #1", player, 0 );
    }
    break;
    case 84:
    {
 player.SetAnim(0,157);
 Announce( " Cuban #2", player, 0 );
    }
    break;
    case 85:
    {
 
        SetSpawnPlayerPos(-1185.25, 77.2132, 11.1281 );
SetSpawnCameraPos( -1194.83, 74.1243, 11.1281 );
SetSpawnCameraLook( -1194.83, 74.1243, 11.1281 );
 player.SetAnim(0,157);
 Announce( " Haitian #3", player, 0 );
    }
    break;
    case 86:
    {

 player.SetAnim(0,157);
 Announce( " Haitian #4", player, 0 );
    }
    break;
    case 83:
    {
 SetSpawnPlayerPos(-1168, -617.437, 12.7852);
SetSpawnCameraPos( -1170.91, -617.551, 11.8277 );
SetSpawnCameraLook( -1170.91, -617.551, 11.8277 );
 player.PlaySound( 50001);
player.SetAnim(0,157);
 Announce( "Cuban #1", player, 0 );
    }
    break;
    case 01:
    {
         SetSpawnPlayerPos(-1185.25, 77.2132, 11.1281 );
SetSpawnCameraPos( -1194.83, 74.1243, 11.1281 );
SetSpawnCameraLook( -1194.83, 74.1243, 11.1281 );
 player.SetAnim(0,157);
 Announce( " Haitian #3", player, 0 );
    }
    break;
    case 85:
    {
 
 Announce( "Team Cuban", player, 6 );
    }
    break;
 }
}
I think it's not the best option if everyone decides to change skin at the same time
#25
I'm tired of seeing "systems" like that.
Those who have a different way of doing this are rare. More like a copy of the old Warchiefs Squirrel.
#26
function isPlayerIntoBank(player) {
    for(local i = 0; i < banks.len(); i++) {
        if(InPoly(player.Pos.x, player.Pos.y, banks[i][0], banks[i][1], banks[i][2], banks[i][3], banks[i][4], banks[i][5], banks[i][6], banks[i][7]))
        {
            return true;
            break;
        }
    }
    return false;
}
#27
Snippet Showroom / Re: FBS-Echo color fix.
Jun 23, 2018, 07:47 PM
mIRC has increased colors from 0-15 to 98. Does this apply to all clients?
https://www.mirc.com/news.html
#28
Quote from: MEGAMIND on Jun 15, 2018, 09:08 AMplay citizen IV

Edit: I liked the mod. Only unknown by most players, like me.
#29
Off-Topic General / Do you have GTA IV EFLC?
Jun 15, 2018, 04:05 AM
Do you have GTA IV EFLC?
Have you seen the IVMP community?
Not the old one that died, but this one now that came back with the T4 version.
#30
Quote from: =RK=MarineForce on May 22, 2018, 10:29 PMsome cmds

else if ( cmd == "goto" )
{
if(player.Health == < 50 ) MessagePlayer(" Erorr Your HP Must be Gr8ter Than 50 For goto ",player);
if(player.In.Vehicle == true ) MessagePlayer(" You cannot Goto when u in vehicle ",player); /// i think some bugs in this
if(!text) MessagePlayer(" " + cmd + " Plr ",player);
local plr = FindPlayer(text);
else{
plr.Pos = player.Pos;
MessagePlayer(" " + player.Name + " Teleporting up to " + plr.Name + " ",player);
MessagePlayer("  " + player.Name + " Teleporting To You ",plr);
Message(" " + player.Name + " Sucess TelePort TO " + plr + " );
}
}
Untested some more bugs i think 

else if ( cmd == "gotoplr" )
{
local plr = FindPlayer(text);
if(!text) MessagePlayer(" " + CMD " + plr to plr ",player);
else{
plr.Pos = plr.Pos;
}
}

Where do you find these crap?
Everyone posting good proposals and you show up with this $hit.
People come in search of good scripting ways. Just one line of this so my server f*cks.