[Help] RequestClass
#1

Hello, I want to know if there is any way to disable the function of the "RequestClass" buttons, I do not want to remove them but rather disable what they do, because I did a background screen for my server login, and wanted to keep it.

What I want to do is that when the player clicks on the "spawn" button for example nothing happens, because when I click in spawn button my character just spawn, even though I have not logged into the server.
Reply
#2

return 0 under onplayerrequestspawn
Reply
#3

Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(LoggedIn[playerid] == 0)
    {
          return 0;
    }
    return 1;
}
You could make a variable to check if the player has entered a correct password and logged in. By having that, you can restrict players from spawning if they did not login.
Reply
#4

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
return 0 under onplayerrequestspawn
It did not work, I click the button and even then the character spawn happens
Reply
#5

Quote:
Originally Posted by Mike861
Посмотреть сообщение
Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(LoggedIn[playerid] == 0)
    {
          return 0;
    }
    return 1;
}
You could make a variable to check if the player has entered a correct password and logged in. By having that, you can restrict players from spawning if they did not login.
Nothing too, the button still working.
Reply
#6

I put the OnPlayerRequestSpawn to return 0 and now its working, the button do nothing, but, when my character spawn, that button don't hide, he still showing, someone know why?
Reply
#7

You need to manually set the spawn info (SetPlayerSpawnInfo) in OnPlayerRequestClass and then toggle the player spectating (on and off again).

Quote:
Originally Posted by Mike861
Посмотреть сообщение
Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(LoggedIn[playerid] == 0)
    {
          return 0;
    }
    return 1;
}
You could make a variable to check if the player has entered a correct password and logged in. By having that, you can restrict players from spawning if they did not login.
The return value of OnPlayerRequestClass just defines whether or not the player will recieve the spawn info, but not if the player stays in the class selection or not.
If you want to restrict a player from spawning, you need to return 0 in OnPlayerRequestSpawn.

Also this has been asked a few hundred times, you could just search for a solution.
Reply
#8

Okay, I did as you said, now for me to remove the buttons after the player has spawned I need to turn TogglePlayerSpectating on and off?
Reply
#9

Quote:
Originally Posted by ApolloScripter
Посмотреть сообщение
Okay, I did as you said, now for me to remove the buttons after the player has spawned I need to turn TogglePlayerSpectating on and off?
Yes, either that or SpawnPlayer(), however spectating works better from my experience.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)