Player Text without being logged in
#1

Hello. I have a register system using Y_INI systems. It works fine, but if you connect with raksamp the dialogs sometimes don't show up, and therefore you can type in the raksamp chat without being logged in.
I have tried to make a function so you cannot type in until your INI data has been loaded, but I don't know how to phrase it other than like this:

Код:
public OnPlayerConnect(playerid)
{	
   gPlayer_Logged[playerid] = 0;
   {
	if(!LoadUser_data)
		{
			SCM(pid, -1, "You are not logged in.");
			return 1;
		}
	}
gPlayer_Logged[MAX_PLAYERS] is a global variable.
Reply
#2

That doesn't make any sense.

Set the gPlayer_Logged[playerid] variable to 1 when the player logs in.
And then under OnPlayerText, check if the player isn't logged in.
Код:
if (!gPlayer_Logged[playerid])
{
    // you are not logged in message...
}
Reply
#3

Quote:
Originally Posted by Stinged
Посмотреть сообщение
That doesn't make any sense.

Set the gPlayer_Logged[playerid] variable to 1 when the player logs in.
And then under OnPlayerText, check if the player isn't logged in.
Код:
if (!gPlayer_Logged[playerid])
{
    // you are not logged in message...
}
That's what I'm trying to do, but I don't know how I would do that.
Reply
#4

Код:
gPlayer_Logged[playerid] = 1;
Where the player logs in.
Reply
#5

It's really simple. Just add the variable
pawn Код:
gPlayer_Logged[playerid] = 1;
when the player spawns or add it in where you load the players information.
Reply
#6

Ok. Thanks for your feedback. I have fixed it.


This is irrelevant to the topic, but I'm trying to make a /setadminoff command, basically setting the admin level to a player which is offline.
I have come here so far:
Код:
CMD:setadminoff(playerid, params[])
{
	new target[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128];
	new para1, level;
	
	if(Player[playerid][pAdmin] < 1338) return SCM(pid, ADMIN_COLOR, ADMIN_MESSAGE);
	
	if(sscanf(params, "ud", para1, level))
	{
		SCM(pid, COLOR_WHITE, "{00E6FF}USAGE:{FFFFFF} /setadminoff [EXACT PLAYER NAME] [LEVEL]");
		return 1;
	}
	
	GetPlayerName(playerid, sendername, sizeof(sendername));
	GetPlayerName(para1, target, sizeof(target));
	
	
	Player[playerid][pAdmin] = level;
	INI_ParseFile(UserPath(para1), "LoadUser_%s", .bExtra = true, .extra = para1);
	INI_Int("Admin", Player[playerid][pAdmin]);
	INI_WriteInt(File, "Admin", Player[playerid][pAdmin]);
	INI_Close(File);
	format(string, sizeof(string), "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s's {FFFFFF}account to a level{FF9203}%d {FFFFFF}admin.", target, sendername, level);
	SendAdminMessage(-1, string);
	return 1;
}
The errors that it gives me are:
Код:
GM.pwn(900) : error 017: undefined symbol "name"
GM.pwn(900) : error 017: undefined symbol "value"
GM.pwn(901) : error 017: undefined symbol "File"
GM.pwn(902) : error 017: undefined symbol "File"
I don't know if this will work even if it compiles, I feel that it is incomplete.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)