PDA

View Full Version : Welcome - NoN Repeat Message


NoDi522
26/03/2015, 08:44 AM
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:

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.

Ahmad45123
26/03/2015, 08:59 AM
Can you show us the code where you save and load the PPPP variable ?

NoDi522
26/03/2015, 09:06 AM
I save it under OnPlayerDisconnect:

PPPP[playerid] = 1;

NoDi522
26/03/2015, 09:08 AM
Should I load it with pvar?

Ahmad45123
26/03/2015, 09:25 AM
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.

CalvinC
26/03/2015, 09:26 AM
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.

NoDi522
26/03/2015, 09:31 AM
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 :) ?

CalvinC
26/03/2015, 09:32 AM
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.

NoDi522
26/03/2015, 09:38 AM
Can you give me an example please? :)
It doesn't have to be with my code.

CalvinC
26/03/2015, 10:13 AM
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.