Help! + rep! -
edzis84 - 23.06.2014
Hello everyone!
Can someone explain me how can I make that specific ussername can use commands before he's logged in.
I have set that you can't type when you aren't logged in at onplayertext
I made a stock like this
Код:
stock test(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(!strcmp(pName,"Test_Test",false)) return 0;
}
and added this @ onplayertext
Код:
if(!PlayerLogged(playerid) || test(playerid))
But it's not working
Re: Help! + rep! -
RenovanZ - 23.06.2014
Show your full OnPlayerText.
But, try this:
pawn Код:
if(!PlayerLogged(playerid) || !test(playerid)) return SendClientMessage(playerid, -1, "You are not logged in.!");
Re: Help! + rep! -
rickisme - 23.06.2014
because stock test always return 0 =.=
Try this:
pawn Код:
stock test(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(strcmp(pName,"Test_Test",false) == 0) return 1;
return 0;
}
Re: Help! + rep! -
edzis84 - 23.06.2014
Nope, this is not working, it still shows me that im not logged in
Re: Help! + rep! -
Jack_Leslie - 23.06.2014
You said commands, but OnPlayerText is for when you chat, not perform a command.
pawn Код:
public OnPlayerText(playerid, text[])
{
if(!PlayerLogged(playerid) && test(playerid)) // && means AND, || means or
{
//code
return 1;
}
return 0;
}
Re: Help! + rep! -
edzis84 - 23.06.2014
Nope, I'm just using onplayertext to make my life easier.
Код:
public OnPlayerText(playerid, text[])
{
if(!PlayerLogged(playerid) || !test(playerid))
{
SCM(playerid, COLOR_GREY, "You're not logged in.");
return 0;
}
So basically I want to make that my specific name can enter text even if he's not logged in
Re: Help! + rep! -
Jack_Leslie - 23.06.2014
As I said above, "||" means OR, and "&&" means AND, so use &&.
pawn Код:
if(!PlayerLogged(playerid) && test(playerid))
And fix your stock, it's always returning 0, as someone else stated above.
Re: Help! + rep! -
RenovanZ - 23.06.2014
I think this will work:
pawn Код:
stock test(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(!strcmp(pName,"Test_Test",false)) return 1;
return 0;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(PlayerLogged(playerid) || test(playerid))
{
//code
return 1;
}
return 0;
}
Re: Help! + rep! -
Jack_Leslie - 23.06.2014
Quote:
Originally Posted by RenovanZ
I think this will work:
pawn Код:
stock test(playerid) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); if(!strcmp(pName,"Test_Test",false)) return 1; return 0; }
pawn Код:
public OnPlayerText(playerid, text[]) { if(PlayerLogged(playerid) || test(playerid)) { //code return 1; } return 0; }
|
No, it won't. He wants it so that if the players name is "Test_test", that he can use commands even when he's not logged in.
pawn Код:
if(PlayerLogged(playerid) || test(playerid))
Is saying, if the player is logged in, OR if he's name is Test_test, he can use commands.
He wants, if the player is NOT logged in, AND the player's name is Test_test, he can use commands, which is:
pawn Код:
if(!PlayerLogged(playerid) && test(playerid))
|| OR
&& AND
*facepalm*
Re: Help! + rep! -
RenovanZ - 23.06.2014
Quote:
Originally Posted by Jack_Leslie
No, it won't. He wants it so that if the players name is "Test_test", that he can use commands even when he's not logged in.
pawn Код:
if(PlayerLogged(playerid) || test(playerid))
Is saying, if the player is logged in, OR if he's name is Test_test, he can use commands.
He wants, if the player is NOT logged in, AND the player's name is Test_test, he can use commands, which is:
pawn Код:
if(!PlayerLogged(playerid) && test(playerid))
|| OR
&& AND
*facepalm*
|
Take a look on his post, he wants everyone except Test_test to logged in before he can chat.
Which mean:
Test_Test doesnt need logged in to chat.