SA-MP Forums Archive
Welcome - NoN Repeat Message - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Welcome - NoN Repeat Message (/showthread.php?tid=568893)



Welcome - NoN Repeat Message - NoDi522 - 26.03.2015

Hello.

So I tried to make a message OnPlayerSpawn which will come just the first time when the player spawns.

I've got here some code:

PHP код:
    new poruka[128],ime[MAX_PLAYER_NAME];
    if(
PPPP[playerid] == 1) return true;
    else if(
PPPP[playerid] == 0)
    {
        {
            
GetPlayerName(playerid,ime,sizeof(ime));
            
SendClientMessage(playerid,-1,"=================================================");
            
SendClientMessage(playerid,-1,"");
            
format(poruka,sizeof(poruka),"{00C0FF}WG:{FFFFFF} Dobrodosao,"COLOR_SIVA" %s {FFFFFF}na{28C1C9} WilderGaming Roleplay",ime);
            
SendClientMessage(playerid,-1,poruka);
            
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Provjerite potpunu listu dostupnih komandi:"COLOR_LAGANA" /komande");
            
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Uzivajte igraju na nasem serveru"COLOR_SIVA" -"COLOR_SVJETLO_PLAVA2" WG:RP Administracija");
            
SendClientMessage(playerid,-1,"");
            
SendClientMessage(playerid,-1,"=================================================");
            
PPPP[playerid] = 1;
        }
    } 
PPPP = Pokazi-Poruku-prvi-put // Show-Message-First-Time

And i doesn't work. I putted onto on...disconnect to save variable after using but nothing again.


Re: Welcome - NoN Repeat Message - Ahmad45123 - 26.03.2015

Can you show us the code where you save and load the PPPP variable ?


Re: Welcome - NoN Repeat Message - NoDi522 - 26.03.2015

I save it under OnPlayerDisconnect:

PPPP[playerid] = 1;


Re: Welcome - NoN Repeat Message - NoDi522 - 26.03.2015

Should I load it with pvar?


Re: Welcome - NoN Repeat Message - Ahmad45123 - 26.03.2015

Quote:
Originally Posted by NoDi522
Посмотреть сообщение
Should I load it with pvar?
You should load and save it just like pData.
And set the PPPP to 1 after sending the message not in OnPlayerDisconnect

EDIT: If you can show your OnPlayerConnect and OnPlayerDisconnect, I can write it for you.


Re: Welcome - NoN Repeat Message - CalvinC - 26.03.2015

No reason to use a pVar, but are you sure it's saving correctly in the user file/database and loading correctly?
It's most likely a problem with your saving/loading.


Re: Welcome - NoN Repeat Message - NoDi522 - 26.03.2015

I am bit confused because i am still learning and you know...
So should i save it in something like enum or?

I just need a little explanation,you event don't have to give me a code. Just tell me 2-3 thing how to save and load those variables without errors in few words ?


Re: Welcome - NoN Repeat Message - CalvinC - 26.03.2015

You don't need to set it in an enumerator, although it would be easier to reset.
But you have to save and load it like you save and load your enumerator arrays.


Re: Welcome - NoN Repeat Message - NoDi522 - 26.03.2015

Can you give me an example please?
It doesn't have to be with my code.


Re: Welcome - NoN Repeat Message - CalvinC - 26.03.2015

You need a saving system for saving, you can use file systems or an SQL database, you would be better off looking at another script with a saving system or some tutorials if you don't know how to save/load.