Removing the OnPlayerRequestClass Spawn button -
SteSte - 17.07.2017
Introducing SteSte's Tutorial...
Well, this is a tutorial if it teaches you how to do a specific thing,
though its short, very short, I'll try to make it long lol.
You know that spawn button under OnPlayerRequestClass? oh you don't.
Well, this is awkward, oh wait, I can show you
If you are using the sa-mp class selection then this tutorial is not for you,
if you don't want that spawn button, maybe you want to make your own, then continue reading.
Removing the spawn button, and those arrows are easy, follow these simple steps below.
Step 1: Under OnPlayerRequestClass, add
Код:
TogglePlayerSpectating(playerid, true);
Step 2: That's it were done, go test it.
Step 3: Oh wait did this happen?
Hahaha, to fix that you need to set the player's spawn info, lets jump to step 4.
Step 4: If you look at the code below, you'll see what you should have for a complete "Spawn" eraser, SetSpawnInfo simply tells the script how to spawn the player, team? skin? positions? weapons? and ammunation. Without setting the spawn info, you'll get kicked, again. TogglePlayerSpectating is the center of the tutorial, it simply set the player to spectating mode, so the spawn doesn't display.
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
TogglePlayerSpectating(playerid, true);
return 1;
}
Now lets see what our readers think
Ste1: Oh thank you very much,
this is what I needed, but how do I get the spawn button back? please help.
Ste2: Well Ste, you just simply follow the tutorial backward.
To add back the spawn button, just toggleplayerspectating to false instead of true, and that concludes the tutorial, comment below.
Thank you for reading, I got the idea of this tutorial from a thread.
Warning, once you remove the spawn button, you won't spawn till you togglespectating mode to false or use the SpawnPlayer Function, so I suggest you make like a timer or /spawnme cmd.
Warning, once you remove the spawn button the mouse also disappears, like if you have your own spawn button with textdraws it won't show, so If you need it you can make it appear in different ways, depends on what your doing.
Re: Removing the OnPlayerRequestClass Spawn button -
Eoussama - 17.07.2017
Cool, I had fun reading it, although It's very simple to even consider as a complete tutorial, still, someone will find it useful, keep up the great work
Re: Removing the OnPlayerRequestClass Spawn button -
saffierr - 17.07.2017
The story is even better than the entire tutorial lol.
Nice work!
Re: Removing the OnPlayerRequestClass Spawn button -
SteSte - 17.07.2017
Quote:
Originally Posted by Eoussama
Cool, I had fun reading it, although It's very simple to even consider as a complete tutorial, still, someone will find it useful, keep up the great work
|
Quote:
Originally Posted by Saffier
The story is even better than the entire tutorial lol.
Nice work!
|
Thx both.
Re: Removing the OnPlayerRequestClass Spawn button -
SmileJack - 17.07.2017
Ehm.. Nice? Okay no, its really usefull for the news users - Sorry for the bad English -
Re: Removing the OnPlayerRequestClass Spawn button -
Jay_ - 18.07.2017
Why are you using TogglePlayerSpectating? This isn't the purpose of this function. SpawnPlayer() would be more relevant here.
Re: Removing the OnPlayerRequestClass Spawn button -
DarkBr - 18.07.2017
good job, Ty!
Re: Removing the OnPlayerRequestClass Spawn button -
SteSte - 18.07.2017
Quote:
Originally Posted by Jay_
Why are you using TogglePlayerSpectating? This isn't the purpose of this function. SpawnPlayer() would be more relevant here.
|
Well yeah, spawnplayer can work to. UPDATED*
Re: Removing the OnPlayerRequestClass Spawn button -
GoldenLion - 19.07.2017
Quote:
Originally Posted by SteSte
Well yeah, spawnplayer can work to. UPDATED*
|
No, using SpawnPlayer while being in spectating mode will bug out the player (you'll be somewhere in the sky flying) so the only way to spawn the player while in spectating mode is by using TogglePlayerSpectating.
Re: Removing the OnPlayerRequestClass Spawn button -
Jay_ - 19.07.2017
Quote:
Originally Posted by GoldenLion
No, using SpawnPlayer while being in spectating mode will bug out the player (you'll be somewhere in the sky flying) so the only way to spawn the player while in spectating mode is by using TogglePlayerSpectating.
|
My point was to replace the spectating function with SpawnPlayer(), and not use both of them in parallel.
Re: Removing the OnPlayerRequestClass Spawn button -
Delorice - 18.02.2018
Useful tutor, thank you