Array

Started by FinchDon, Sep 17, 2015, 03:34 PM

Previous topic - Next topic

FinchDon

Hello I have added this onScriptLoad

hello <- false;


and make this cmd


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 )

.

.

Xmair

By using query.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

#3
Array will get removed as soon as you close the server
SO if u want to store permanently use DataBase aka SQLite or MySQL
oh no

.

Quote from: KAKAN on Sep 17, 2015, 04:17 PMArray will get removed as soon as you close the server

WOW, JUST WOW. Wasn't that obvious until now?
.

EK.IceFlake

"else if ( ( cmd == "hello" ) || ( cmd == "hello" ) )"
...

MatheuS

hello <- false;
as will identifying which player? ???
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

FinchDon

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

fuzzie's account system updates player stats when player leaves

KAKAN

Quote from: Debian on Sep 18, 2015, 04:33 AMfuzzie'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!
oh no

FinchDon

i made this

if ( cmd == "a" ) pstats[ player.ID ].BFME += 2;
and this

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

What u mean LOL?
Show us the whole system, else nothing gonna happen
oh no

Debian

did you add BMFE in player class?

FinchDon

For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Mashreq

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:
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 );
}