SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 17/07/2017, 11:27 PM   #1
SteSte
Big Clucker
 
SteSte's Avatar
 
Join Date: Aug 2015
Location: United States
Posts: 190
Reputation: 20
Default Removing the OnPlayerRequestClass Spawn button

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
Code:
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 Code:
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.
__________________
Interested in scripting creative and unique scripts? PM me here.
SKYPE: Heroleo911003
Discord: Ste-Ste#7377
I prefer Discord at the moment, skype works to.
I'm currently working on a survival script where players have real scripted powers.

Last edited by SteSte; 18/07/2017 at 11:41 PM.
SteSte is offline   Reply With Quote
Old 17/07/2017, 11:34 PM   #2
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,121
Reputation: 153
Default Re: Removing the OnPlayerRequestClass Spawn button

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
__________________
Eoussama is online now   Reply With Quote
Old 17/07/2017, 11:40 PM   #3
saffierr
High-roller
 
saffierr's Avatar
 
Join Date: Jul 2013
Location: GetPlayerGirlHouse(targetplayer);
Posts: 1,155
Reputation: 36
Default Re: Removing the OnPlayerRequestClass Spawn button

The story is even better than the entire tutorial lol.
Nice work!
saffierr is offline   Reply With Quote
Old 17/07/2017, 11:48 PM   #4
SteSte
Big Clucker
 
SteSte's Avatar
 
Join Date: Aug 2015
Location: United States
Posts: 190
Reputation: 20
Default Re: Removing the OnPlayerRequestClass Spawn button

Quote:
Originally Posted by Eoussama View Post
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.
__________________
Interested in scripting creative and unique scripts? PM me here.
SKYPE: Heroleo911003
Discord: Ste-Ste#7377
I prefer Discord at the moment, skype works to.
I'm currently working on a survival script where players have real scripted powers.
SteSte is offline   Reply With Quote
Old 18/07/2017, 12:45 AM   #5
SmileJack
Big Clucker
 
SmileJack's Avatar
 
Join Date: Jul 2017
Posts: 84
Reputation: 0
Default Re: Removing the OnPlayerRequestClass Spawn button

Ehm.. Nice? Okay no, its really usefull for the news users - Sorry for the bad English -
SmileJack is offline   Reply With Quote
Old 18/07/2017, 05:37 PM   #6
Jay_
Beta Tester
 
Jay_'s Avatar
 
Join Date: Jul 2009
Posts: 661
Reputation: 188
Default Re: Removing the OnPlayerRequestClass Spawn button

Why are you using TogglePlayerSpectating? This isn't the purpose of this function. SpawnPlayer() would be more relevant here.
__________________
Jay_ is offline   Reply With Quote
Old 18/07/2017, 05:42 PM   #7
DarkBr
Huge Clucker
 
Join Date: Feb 2017
Location: Brasil - SP
Posts: 386
Reputation: 7
Default Re: Removing the OnPlayerRequestClass Spawn button

good job, Ty!
DarkBr is offline   Reply With Quote
Old 18/07/2017, 11:39 PM   #8
SteSte
Big Clucker
 
SteSte's Avatar
 
Join Date: Aug 2015
Location: United States
Posts: 190
Reputation: 20
Default Re: Removing the OnPlayerRequestClass Spawn button

Quote:
Originally Posted by Jay_ View Post
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*
__________________
Interested in scripting creative and unique scripts? PM me here.
SKYPE: Heroleo911003
Discord: Ste-Ste#7377
I prefer Discord at the moment, skype works to.
I'm currently working on a survival script where players have real scripted powers.
SteSte is offline   Reply With Quote
Old 19/07/2017, 11:58 AM   #9
GoldenLion
Gangsta
 
GoldenLion's Avatar
 
Join Date: Sep 2014
Location: Estonia
Posts: 962
Reputation: 129
Default Re: Removing the OnPlayerRequestClass Spawn button

Quote:
Originally Posted by SteSte View Post
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.
GoldenLion is offline   Reply With Quote
Old 19/07/2017, 12:05 PM   #10
AbyssMorgan
High-roller
 
AbyssMorgan's Avatar
 
Join Date: Apr 2015
Location: Poland
Posts: 1,262
Reputation: 323
Default Re: Removing the OnPlayerRequestClass Spawn button

This button shown after OnPlayerConnect is finished, so register/login dialog needs to add in OnPlayerConnect.
AbyssMorgan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
spawn button. n00el Scripting Help 6 20/05/2014 07:43 PM
Remove the spawn by the Spawn Button Gilmar Scripting Help 6 07/04/2014 09:34 PM
OnPlayerRequestClass [Determine Button] Glad2BeHere Scripting Help 5 08/06/2013 11:10 AM
Previous button In OnPlayerRequestClass LuisGraph Scripting Help 2 25/02/2012 03:06 AM


All times are GMT. The time now is 08:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.