This topic was marked solved by its starter, on September 19th, 2015, 09:00 AM
Array

FinchDon

  • Sr. Member
  • Posts: 252
Array
« on September 17th, 2015, 04:34 PM »
Hello I have added this onScriptLoad

hello <- false;


and make this cmd


Code: [Select]
else if ( ( cmd == "hello" ) || ( cmd == "hello" ) )
{
local plr, b;
for( local i = 0; i < GetMaxPlayers(); i++ )
{
    plr = FindPlayer( i );
if ( ( plr ) && ( hello ) )
    {
if ( b ) b = b + ", " + plr.Name + " (" + hello + ")"
else b = plr.Name + " (" + hello + ")"
    }
}
if ( b ) Message( "**In Game[ Hell Online: [ " + b + " ] ]" );
else Message( "** In Game [ No HEll Online ]." );
}
if ( cmd == "hell")
{
if ( pstats[ player.ID ].Logged == false ) PrivMessage( player, "You are not logged in");
   else
{
hello = true;
PrivMessage( player, "Congratulation You Become New Hell Gate");
}
}


Now when i do /hell it show you become and then i type !hell it show name FinchDon but when i restart server and i join type !hell it show no hell online How i can store data for permanent?
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,807
Re: Array
« Reply #1, on September 17th, 2015, 05:10 PM »
.

Xmair

  • Wiki Contributor
  • Posts: 930
Re: Array
« Reply #2, on September 17th, 2015, 05:13 PM »
By using query.
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Array
« Reply #3, on September 17th, 2015, 05:17 PM »Last edited on September 17th, 2015, 05:50 PM
Array will get removed as soon as you close the server
SO if u want to store permanently use DataBase aka SQLite or MySQL
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,807
Re: Array
« Reply #4, on September 17th, 2015, 05:25 PM »
Quote from KAKAN on September 17th, 2015, 05:17 PM
Array will get removed as soon as you close the server
WOW, JUST WOW. Wasn't that obvious until now?
.

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761
Re: Array
« Reply #5, on September 17th, 2015, 07:36 PM »
"else if ( ( cmd == "hello" ) || ( cmd == "hello" ) )"
...

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 469
Re: Array
« Reply #6, on September 17th, 2015, 10:00 PM »
Code: [Select]
hello <- false;

as will identifying which player? ???
Code: [Select]
if( !sucess ) tryAgain();

FinchDon

  • Sr. Member
  • Posts: 252
Re: Array
« Reply #7, on September 18th, 2015, 02:42 AM »
I am FuZzie Account system it has update function bank= " + bank + " so how can i update array BFMe and save it in db?
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Debian

  • Jr. Member
  • Posts: 62
Re: Array
« Reply #8, on September 18th, 2015, 05:33 AM »
fuzzie's account system updates player stats when player leaves

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Array
« Reply #9, on September 18th, 2015, 05:55 AM »
Quote from Debian on September 18th, 2015, 05:33 AM
fuzzie's account system updates player stats when player leaves
Everyone who has take a look at the code, knows it, He had not taken a look at the code tho!
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

FinchDon

  • Sr. Member
  • Posts: 252
Re: Array
« Reply #10, on September 18th, 2015, 09:05 AM »
i made this

Code: [Select]
if ( cmd == "a" ) pstats[ player.ID ].BFME += 2;

and this

Code: [Select]
if ( cmd == "v" ) PrivMessage( player, " " + pstats[ player.ID ].BFME + "." );

Now when i type !a and !v it show BFME 2 and i add this on fuzzie account updater

BFME= " + pstats[ player.ID ].BFME + "



But when i rejoin it show BFME 0 Why?
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Array
« Reply #11, on September 18th, 2015, 09:16 AM »
What u mean LOL?
Show us the whole system, else nothing gonna happen
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

Debian

  • Jr. Member
  • Posts: 62
Re: Array
« Reply #12, on September 18th, 2015, 09:24 AM »
did you add BMFE in player class?

FinchDon

  • Sr. Member
  • Posts: 252
Re: Array
« Reply #13, on September 18th, 2015, 09:38 AM »
Yes
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Mashreq

  • Full Member
  • Posts: 126
Re: Array
« Reply #14, on September 18th, 2015, 10:46 AM »
Are you sure that your BFME score gets saved into database when you leave the server?

Are you settting your BFME array's score from your database when you join the server?
something like this:
Code: [Select]
function onPlayerJoin( player )
{
//load here your class
local query = QuerySQL( db, "SELECT BFME FROM Your_Account_Table WHERE Name= '" + player.Name + "'" );
if ( GetSQLColumnData( query, 0 ) )
{
pstats[ player.ID ].BFME = GetSQLColumnData( query, 0 );
}
FreeSQLQuery( query );
}