Y_INI question
#1

Hello Guys.

I just started with a brand new server. I made a Roleplay test, and it works fine.
The only problem is that if a player cancels the Roleplay test (and gets kicked), and relogs, he
Will spawn (so he didnt do the Roleplay test but he's still able to play). So i need a system which
Checks if he did the Roleplay test already. The roleplay test comes after a player registered.
I was thinking about something like this:

Код:
enum pInfo
{
	pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
	pRPTEST
}
Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("RpTest",PlayerInfo[playerid][pRPTEST]);
    return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"RpTest",PlayerInfo[playerid][pRPTEST]);
    INI_Close(File);
    return 1;
}
Код:
case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WIT"Register",""ROOD"You have entered an invalid password.\n"DONKER_ROOD"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"RpTest",0);
				INI_Close(File);

                SendClientMessage(playerid,0x7FFF7AFF,"Registration succeed!");
				SetPlayerPos(playerid,2109.1763,1503.0453,32.2887);
				ShowPlayerDialog(playerid, DIALOG_ROLEPLAY, DIALOG_STYLE_MSGBOX, "Roleplay Test", "You will now proceed to the Roleplay Test.", "Ok", "Quit");
			}
        }
So i (probably) need a line at the end of the RP Tutorial that sets the player's RPTEST to 1, and when
A player spawns (not at connect, because he needs to log in first), the system checks if he did the RP test.

Anyone knows how to do this? I hope i explained it well.

Greetings, CrazyManiac
Reply
#2

find something like on player register .... you know where is end of tutorial , where server spawns player and INI_WriteInt(File,"RpTest",1);

EDIT : sorry i'm so tired i didn't saw everything .... make check at OnPlayerDisconnect
Reply
#3

Underneith INI_Close(File); :

pawn Код:
INI_ParseFile( UserPath( playerid ) "LoadUser_%s", .bExtra = true, .extra = playerid );
Parsefile is what loads the information.
Reply
#4

I see, but unfortunaly, thats not the problem. The problem is that when you finish the RP test, it EDITS your "RPTEST=0" into "RPTEST=1", so when a player connects, the system can check if he did the RP test yet (checking if it's 0 or 1).

Anyone can help me with it / anyone know a better way to let the system check if someone finished the RP test?
Reply
#5

Ok thanks, so now i know how i change the PlayerInfo. Now, does anybody knows a line that i can use for CHECKING if its 0 or 1?? If its 0, it does:
Код:
ShowPlayerDialog(playerid, DIALOG_ROLEPLAY, DIALOG_STYLE_MSGBOX, "Roleplay Test", "You will now proceed to the Roleplay Test.", "Ok", "Quit");
(I already have a DialogResponse for DIALOG_ROLEPLAY.)

If its 1, then in this case it does nothing yet.
Reply
#6

If what?

Код:
if PlayerInfo[playerid][pRPTEST] = 0 return ShowPlayerDialog...........
?

Can someone fix this one for me? not sure what it is.
Reply
#7

OnPlayerSpawn

If PlayerInfo[playerid][pRPtest] == 0)
( tut script here)

If PlayerInfo[playerid][pRPtest] == 0)
SendClientMessage(playerid,Color,"Here you could use a welcome message"); +REP if I helped
Reply
#8

Quote:
Originally Posted by Drake_Lopez
Посмотреть сообщение
+REP if I helped
Not asking for reputation, is how you get it. Asking for it, will just get you less.

On Topic:

I am confused. It seems that you don't actually have the test taking code in place yet?
Reply
#9

Код:
public OnPlayerSpawn(playerid)
{
	if PlayerInfo[playerid][pRPTEST] == 0)
	(
		SendClientMessage(playerid,0xFFFFFFFF,"[Note]: You didn't finish the Roleplay Test yet!");
		ShowPlayerDialog(playerid, DIALOG_TEST1, DIALOG_STYLE_LIST, "Where does 'MG' stand for?", "Mixing Game\nMeta Game\nMood Gaming", "OK");
		SetPlayerColor(playerid,0x5E5E5EFF);
	)
	else
	(
	    SendClientMessage(playerid,0xFFFFFFFF,"[Note]: Welcome back to Los Santos Prison Roleplay!");
	    SetPlayerColor(playerid,0xBABABAFF);
	    SetWeather(1);
	)
	return 1;
}
Why doesnt this works?
Reply
#10

Quote:
Originally Posted by CrazyManiac
Посмотреть сообщение
Код:
public OnPlayerSpawn(playerid)
{
	if PlayerInfo[playerid][pRPTEST] == 0)
	(
		SendClientMessage(playerid,0xFFFFFFFF,"[Note]: You didn't finish the Roleplay Test yet!");
		ShowPlayerDialog(playerid, DIALOG_TEST1, DIALOG_STYLE_LIST, "Where does 'MG' stand for?", "Mixing Game\nMeta Game\nMood Gaming", "OK");
		SetPlayerColor(playerid,0x5E5E5EFF);
	)
	else
	(
	    SendClientMessage(playerid,0xFFFFFFFF,"[Note]: Welcome back to Los Santos Prison Roleplay!");
	    SetPlayerColor(playerid,0xBABABAFF);
	    SetWeather(1);
	)
	return 1;
}
Why doesnt this works?
What isn't working? Errors? Just not working in game or what?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)