[Tutorial] Removing the OnPlayerRequestClass Spawn button
#1

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(playeridclassid)
{
    
SetSpawnInfo(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo);
   
    
TogglePlayerSpectating(playeridtrue);
    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.
Reply
#2

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
Reply
#3

The story is even better than the entire tutorial lol.
Nice work!
Reply
#4

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.
Reply
#5

Ehm.. Nice? Okay no, its really usefull for the news users - Sorry for the bad English -
Reply
#6

Why are you using TogglePlayerSpectating? This isn't the purpose of this function. SpawnPlayer() would be more relevant here.
Reply
#7

good job, Ty!
Reply
#8

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*
Reply
#9

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.
Reply
#10

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.
Reply
#11

Useful tutor, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)