Problem with login before spawn - 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: Problem with login before spawn (
/showthread.php?tid=395292)
Problem with login before spawn -
Channeru - 25.11.2012
Hi,
I have a problem.. What i have to do if i want use only /login command before spawn? Any other commands are disabled.
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!IsPlayerSpawned(playerid))
{
if (strcmp(cmdtext, "/login", true))
{
.....
it not works because, if i type password it says i'm not spawned.
Re: Problem with login before spawn -
[D]ry[D]esert - 25.11.2012
show us your IsPlayerSpawned();
Re: Problem with login before spawn -
Channeru - 25.11.2012
It is not important ..
pawn Код:
stock IsPlayerSpawned(playerid)
{
return pData[playerid][P_Spawned];
}
Re: Problem with login before spawn -
dr.lozer - 25.11.2012
do like this
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(PlayerInfo[playerid][LoggedIn] == 0) // People use this kind of functions :P you must use your own!
{
SendClientMessage(playerid, COLOR_RED,"ERROR: Your not loggedin to get spawn");
return 0;
}
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
/*if (!IsPlayerSpawned(playerid)) we dont need this
{*/
if (!strcmp(cmdtext, "/login", true)) // you forgot to put ! in there
{
Re: Problem with login before spawn -
Channeru - 25.11.2012
Quote:
Originally Posted by dr.lozer
do like this
pawn Код:
public OnPlayerRequestSpawn(playerid) { if(PlayerInfo[playerid][LoggedIn] == 0) // People use this kind of functions :P you must use your own! { SendClientMessage(playerid, COLOR_RED,"ERROR: Your not loggedin to get spawn"); return 0; } return 1; }
public OnPlayerCommandReceived(playerid, cmdtext[]) { /*if (!IsPlayerSpawned(playerid)) we dont need this {*/ if (strcmp(cmdtext, "/login", true)) {
|
We need it! Because i don't want to use other commands. In request class you can't type any commands only Login.. And that my function says you can't use any commands except /login.
Re: Problem with login before spawn -
dr.lozer - 25.11.2012
Quote:
Originally Posted by Channeru
blah blah blah
|
Ok ok now it works or not ?? see my post i edited it.. you forgot to put the ! before strcmp O.O
Re: Problem with login before spawn -
Channeru - 25.11.2012
false strcmp mean condition is right and it send message i am not spawned <- IT happens if i wouldn't type login command.