No talking/spawning until logging in..? -
_Vortex - 06.09.2009
Hello, I am trying to make it so if someones registered, and they join the server, they need to login before spawning and talking.. How do I do this?
Here's my player enum if it helps.
Код:
enum PlayerInfo {
gName,
Password,
Level,
Regged,
Logged,
Money,
Kills,
Deaths,
}
Thanks
Re: No talking/spawning until logging in..? -
HuRRiCaNe - 06.09.2009
is strange, your enum should include a register
pawn Код:
enum PlayerInfo {
gName,
Registered,
Password,
Level,
Regged,
Logged,
Money,
Kills,
Deaths,
}
under OnPlayerRequestSpawn
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if ( PlayerInfo[playerid][Logged] == 0 &&PlayerInfo[playerid][Registered] == 1 )
{
SendClientMessage(playerid,red,"Your Account Is registered , you have to login before spawn!");
return 0;//when it returns 0 it doesnt let the player spawn!
}
return 1;
}
under OnPlayerText
pawn Код:
public OnPlayerText(playerid, text[])
{
if (PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][Logged]== 0)
{
SendClientMessage(playerid, red, "Your account is Registered , Login in order to talk!");
return 0;//same as onplayerrequestspawn
}
well , also you should make that when player registers
PlayerInfo[playerid][Registered] =1;
and when player loggins
PlayerInfo[playerid][Logged]=1;
Re: No talking/spawning until logging in..? -
Hiitch - 06.09.2009
For me I just did this :
new Spawned[MAX_PLAYERS]; (can go anywhere)
Under > OnPlayerRequestSpawn < put : Spawned[playerid] = 0;
Under > OnPlayerSpawn < put : Spawned[playerid] = 1;
Under > OnPlayerText < put :
if (Spawned[playerid] == 0)
{
SendClientMessage(playerid, 0xFF0000FF, "You need to spawn to talk !");
return 0;
}
and under OnPlayerCommandText put :
if (Spawned[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You are not spawned !");
{
}
See if that works. I made this today because I was thinking about that too
For the login part, you will have to put Spawned[playerid] = 1) somewhere // 1 means Is Spawned and 0 means isnt spawned.
Re: No talking/spawning until logging in..? -
gemadon - 07.09.2009
under OnPlayerText...
Put Your enum, and put if([Player][Logged] == 0) SendClientMessage(playerid, COLOR_RED, "You must be logged in to do that command!"); Under OnPlayerSpawn put something like if([Player][Logged] == 0) Kick(playerid);
XD
Re: No talking/spawning until logging in..? -
SanMarinoRP - 07.09.2009
oh ok good my friend needed this, Thanks for the answers