SA-MP Forums Archive
[Help] RequestClass - 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: [Help] RequestClass (/showthread.php?tid=661446)



[Help] RequestClass - ApolloScripter - 04.12.2018

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.


Re: [Help] RequestClass - v1k1nG - 04.12.2018

return 0 under onplayerrequestspawn


Re: [Help] RequestClass - Mike861 - 04.12.2018

Код:
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.


Re: [Help] RequestClass - ApolloScripter - 04.12.2018

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


Re: [Help] RequestClass - ApolloScripter - 04.12.2018

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.


Re: [Help] RequestClass - ApolloScripter - 04.12.2018

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?


Re: [Help] RequestClass - NaS - 04.12.2018

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.


Re: [Help] RequestClass - ApolloScripter - 04.12.2018

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?


Re: [Help] RequestClass - NaS - 04.12.2018

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.