Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: Nihongo^ on Jan 01, 2019, 06:14 PM

Title: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 01, 2019, 06:14 PM
Quote from: ! on Jan 01, 2019, 01:57 PMRegisterClan( player, Clan, Owner.tolower(ss) );
Why is there ss inside brackets?



Ah shit i think i mistakenly wrote "ss" while pasting Code HERE
there's no "ss" on my command i mistakenly put while pasting it

QuoteThe message in the server clearly says that the argument OwnerNick received is empty string.

I've fix that problem sir by putting the old gettok function i am facing an other problem now I've added members on db the script is counting my kills and deats ( AS OWNER NOT MEMBER ) but not counting my member's kills/deaths

check the pic kindly i just killed [MD]Test which mean it has to increase Clan deaths too

(https://i.postimg.cc/qB1GX9FM/2019-01-01-23-07-49-0382.png)
Which function should i need to show you ?

here's on player kill function

if ( status[ killer.ID ].Clan != null )
{
local Clan = status[ killer.ID ].Clan;
IncTagKills( Clan );
}
if ( status[ player.ID ].Clan != null )
{
local Clan = status[ player.ID ].Clan;
IncTagDeaths( Clan );
}
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 04, 2019, 02:24 PM
any one ?
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: ! on Jan 04, 2019, 04:10 PM
Without source or any detail info I can simply throw some steps to follow and post the result here

Steps

1. Make sure if the clan tag of player is not null for a simple debug use this inside onPlayerKill
print( "Killer clan is: "+status[ killer.ID ].Clan );
print( "Killed player clan is: "+status[ player.ID ].Clan );
If both of the clans are not null procede to step 2

2. Post the IncTagDeaths( Clan ); maybe there is something wrong in this function which cause the bug.

3. Make sure the clan is registered with proper tag in the database and both the tag in players account and in clans match.
       For sure this step is not necessary cause the kills has been increased means the tags are correct and match, but who knows what you have done in the source maybe you messed a line which cause a bug to update a different tag.
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 06, 2019, 06:06 AM
Hello Sir first of all i am sorry for giving you late reply i was bit busy with my real life activity really apologize

1)
That's what i get after placing the print function
(https://i.postimg.cc/Y9brPpSx/Clan.png)

2)
Here's the function
  function IncTagKills( Clan )
  {
  local UP = ClanKills( Clan ) + 1;
  QuerySQL(db, "UPDATE ClanStats SET Kills='"+UP+"' WHERE Clan='"+ Clan+"'");
  //QuerySQL( db, format( "UPDATE ClanStats SET Kills='%i' WHERE Clan='"+Clan+"'", UP ) );
  //local query1 = format( "UPDATE ClanStats SET Kills=%i WHERE Clan='"+Clan+"'", UP );
  //::QuerySQL( ClanStats, query1 );
  }
 
  function IncTagDeaths( Clan )
  {
  local DOWN = ClanDeaths( Clan ) + 1;
  QuerySQL(db, "UPDATE ClanStats SET Deaths='"+DOWN+"' WHERE Clan='"+ Clan+"'");
  //QuerySQL( db, format( "UPDATE ClanStats SET Deaths='%i' WHERE Clan='"+Clan+"'", DOWN ) );
  //local query1 = format( "UPDATE ClanStats SET Deaths=%i WHERE Clan='"+Clan+"'", DOWN );
  //::QuerySQL( ClanStats, query1 );
  }

3)
That's what i put on my database the script not reading the CLan Members column if it start reading it then i can put other tags to like MDt MDr etc
(https://i.postimg.cc/Cx22ymX2/test.png)

For FULL IMAGE

https://postimg.cc/WdM8g62m
   
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 06, 2019, 06:12 AM
ALso sir if you don't mind i can send you the clan function cuz i don't have idea which function should i need to show you
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 06, 2019, 12:39 PM
.
 
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: ! on Jan 07, 2019, 11:58 AM
Quote from: Nihongo^ on Jan 06, 2019, 06:06 AM1)
That's what i get after placing the print function
(https://i.postimg.cc/Y9brPpSx/Clan.png)
And this is the answer to your question in first post.

The player clan was null always means the player was not assigned the clan tag which can be because of a possible bug in a function where the clan tag was assigned upon player join.
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 07, 2019, 02:52 PM
Quote from: ! on Jan 07, 2019, 11:58 AM
Quote from: Nihongo^ on Jan 06, 2019, 06:06 AM1)
That's what i get after placing the print function
(https://i.postimg.cc/Y9brPpSx/Clan.png)
And this is the answer to your question in first post.

The player clan was null always means the player was not assigned the clan tag which can be because of a possible bug in a function where the clan tag was assigned upon player join.

I don't find any function that assigned tags ( killer or player )  i am bit confused can i show you some codes via pm ? If you don't mind ?
P.S isn't this clan stats made by u ?
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: ! on Jan 08, 2019, 09:22 AM
Quote from: Nihongo^ on Jan 07, 2019, 02:52 PMI don't find any function that assigned tags ( killer or player )  i am bit confused can i show you some codes via pm ? If you don't mind ?
P.S isn't this clan stats made by u ?
First of all the clan system I released was buggy and was developed when I was not sure how the things work the only reason I removed the topic but that one worked well on a blank server if you still have those files try on a blank server it will definitely work except some bugs in few commands PS contact on discord not this forum PM.

There is a function which assigns the tags to player upon joining but I think the problem is not in that function maybe the player was never assigned a clan tag in the database.


I would still recommend you to leave this clan system and make a new one from scratch rather wasting time on bugs.
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 10, 2019, 04:07 AM
I Understand Thanks for giving reply its better to leave this clan system since its buggy.
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: Nihongo^ on Jan 10, 2019, 04:16 AM
one question what is made a function that assign player a clan tag in the database. does it work ?
Title: Re: Clanstats Not Counting member's Kills and deaths
Post by: AroliS^ on Feb 23, 2019, 10:37 PM
this will allow your clan system to count kills and deaths, -> Not tested it.
I just did these simple function for you if you still need it, just change it according your command.

function IncTagKills( clan, kills )
{
QuerySQL( clanstat, "UPDATE ClanStats SET Kills='" +  kills.tointeger() + "' WHERE Clan='" + clan + "'");
print("Clan kills: "+kills.tointeger() )
}

function IncTagDeaths( clan, deaths )
{
QuerySQL( clanstat, "UPDATE ClanStats SET Deads='" +  deaths.tointeger() + "' WHERE Clan='" + clan + "'");
print("Clan deads: "+deaths.tointeger() )
}

function IsClanRegister( clan )
{
        local Result = ::QuerySQL( clanstat, "SELECT Clan FROM ClanStats WHERE Clan='" + clan + "' COLLATE NOCASE" );
        local Reg = ::GetSQLColumnData( Result, 0 ); 
        return ( Reg ) ? Reg : null;
 FreeSQLQuery( Result );
}


and this goes on onplayerkill
if ( GetTag( killer.Name ) && IsClanRegister( GetTag( killer.Name ).tolower() ) ) { IncTagKills(  GetTag( killer.Name ), ( pstatus[ killer.ID ].Kills )+1 ); }
if ( GetTag( player.Name ) && IsClanRegister( GetTag( player.Name ).tolower() ) ) { IncTagDeaths(  GetTag( killer.Name ),( pstatus[ player.ID ].Deaths )+1 ); }