SA-MP Forums Archive
Disabling Class Request without spawning player? - 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: Disabling Class Request without spawning player? (/showthread.php?tid=622935)



Disabling Class Request without spawning player? - Tass007 - 28.11.2016

Hey guys. I've come up with my own sort of class request sort of thing and I don't want the server to have OnPlayerRequestClass is there any way to bypass or disable? I've done all the

PHP код:
public OnPlayerRequestClass(playerid,classid)
{
     
SpawnPlayer(playerid);
     return 
1;

However I don't want to spawn the player, I want them to stay in "Camera Mode" without spawning them until they press my created "Spawn" button.

I've tried TogglePlayerSpectating(playerid, true); however that ruins all the cameras and my create class request sort of thing.

Does anyone have any ideas??


Re: Disabling Class Request without spawning player? - Alvitr - 28.11.2016

https://sampwiki.blast.hk/wiki/OnPlayerRequestClass

have you tried return 0 ?


Re: Disabling Class Request without spawning player? - Tass007 - 28.11.2016

I just tried it now and it doesn't do anything, it still shows requestclass.

https://sampforum.blast.hk/showthread.php?tid=542659


Re: Disabling Class Request without spawning player? - Alvitr - 28.11.2016

if you want hide that button << >> spawn

might use this
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
TogglePlayerSpectating(playeridtrue);
    return 
0;




Re: Disabling Class Request without spawning player? - Tass007 - 28.11.2016

As I've said above in my first post. Doing that deletes all my cameras and doesn't allow me to use my creation.


Re: Disabling Class Request without spawning player? - Alvitr - 28.11.2016

i'm sorry x___x..

there's 2 way can make that as i know,

1: check player login or not, and use camera in OnPlayerRequestClass
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if(!
Login[playerid]){
        
TogglePlayerSpectating(playeridtrue);
        
InterpolateCameraLookAt(playerid50.050.010.0, -50.050.010.010000CAMERA_MOVE);
    }
    return 
0;
}
public 
OnPlayerConnect(playerid)
{
    return 
1;

2: delay load Camera:
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
TogglePlayerSpectating(playeridtrue);
    return 
0;
}
public 
OnPlayerConnect(playerid)
{
    
SetTimerEx("YOUR_CAMERA_FUNCTION"5000false"i"playerid);
    return 
1;
}
PUBLIC:
YOUR_CAMERA_FUNCTION(playerid)
{
    
TogglePlayerSpectating(playeridtrue);
    
InterpolateCameraLookAt(playerid50.050.010.0, -50.050.010.010000CAMERA_MOVE);




Re: Disabling Class Request without spawning player? - Tass007 - 28.11.2016

It's all goods. Hummm I'm just using SetPlayerCameraPos, but I can't be in Spectating mode as my class creation is using TextDraws and in order to click on textdraws I need to use SelectTextDraw and I can't use SelectTextDraw whilst in spectating mode. Are there no other possible ways?


Re: Disabling Class Request without spawning player? - Alvitr - 28.11.2016

maybe this is not the best way to make it,
but you can try it,
it's worked.

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
SpawnPlayer(playerid);
    
TogglePlayerSpectating(playeridtrue);
    
SetTimerEx("dealycamera"5000false"i"playerid);
    return 
0;
}
forward dealycamera(playerid);
public 
dealycamera(playerid)
{
    
SetPlayerCameraPos(playerid652.23457.2110.84);
    
SetPlayerCameraLookAt(playerid652.23427.2110.841);
    
SelectTextDraw(playerid0x00FF00FF);
}
public 
OnPlayerConnect(playerid)
{
    
SetSpawnInfoplayerid001958.331343.12999.36269.152636281500);
    return 
1;

https://sampwiki.blast.hk/wiki/SetPlayerCameraPos
Quote:

You may also have to use SetPlayerCameraLookAt with this function in order to work properly.

https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt

final
https://sampwiki.blast.hk/wiki/SelectTextDraw


Re: Disabling Class Request without spawning player? - Tass007 - 28.11.2016

Awesome thanks so much!