< > & Spawn button
#1

Alright, i fixed the spawn button, means if the player presses on it, it'll say "You need to login first"

but is it possible to make the same on the other 2 buttons?
Reply
#2

Never tried it before but..

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SendClientMessage(playerid, -1, "Please login");
    return 0;
}
You will need to edit it ofc.
Reply
#3

Nope, it doesn't work
Reply
#4

Quote:
Originally Posted by Dripac
Посмотреть сообщение
Nope, it doesn't work
you have to use OnPlayerRequestSpawn callback


and switch classes?
Reply
#5

Quote:
Originally Posted by vassilis
Посмотреть сообщение
you have to use OnPlayerRequestSpawn callback


and switch classes?
He should use it on the OnPlayerRequestSpawn for the first case on "Spawn Button"
For the two buttons ( < > ) use as iTorran said the OnPlayerRequestClass Callback.
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    if( !IsPlayerLogin[ playerid ] ) // ofc replace it with your variable's name.
    {
        SendClientMessage( playerid, -1, "You need to login first" );
        return 0;
    }
    return 1;
}
Reply
#6

Or, you're checking it with a boolean:

pawn Код:
bool:loggedIn[MAX_PLAYERS];
Under "OnPlayerLogin" add this:

pawn Код:
loggedIn[playerid] == true;
Then, you could - as Dwane already said - check whether the player's logged in or not:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
  if(loggedIn[playerid] == false)
  {
    SendClientMessage(playerid, -1, "You'll have to login before changing / choosing classes!");
    return 0;
  }
   //rest
Reply
#7

Alright guys, i will try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)