SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/05/2020, 08:04 AM   #1
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 228
Reputation: 4
Default Spawn button... skipping it with Spectating doesn't work

in these 2 videos you will see what is happening.
https://www.youtube.com/watch?v=PGS-...ature=youtu.be
https://www.youtube.com/watch?v=g3U3...ature=youtu.be

my code:
PHP Code:
public OnPlayerRequestClass(playeridclassid) {
    
    if(
PlayerInfo[playerid][IsLoggedIn]) return SpawnPlayer(playerid);
    
TogglePlayerSpectating(playerid1);
    return 
false;

at login
PHP Code:
            if (strcmp(hashed_passPlayerInfo[playerid][pPassword]) == 0) {
                
cache_set_active(PlayerInfo[playerid][Cache_ID]);
                
AssignPlayerData(playerid);
                
cache_delete(PlayerInfo[playerid][Cache_ID]);
                
PlayerInfo[playerid][Cache_ID] = MYSQL_INVALID_CACHE;
                
KillTimer(PlayerInfo[playerid][LoginTimer]);
                
PlayerInfo[playerid][LoginTimer] = 0;
                
PlayerInfo[playerid][IsLoggedIn] = true;
                
OnPlayerLoginIn(playeridhashed_pass); // this is the next one 
            



PHP Code:
function OnPlayerLoginIn(playerid, const password[]) { // which can be found here
    
TogglePlayerSpectating(playerid0); 
    
SpawnPlayer(playerid);
... 
etc ...etc
i have tried every damn topic on this forum, and it doesn't solve my problem at all. i want to try something else, maybe someone has another idea...
__________________
hopeonxanny is online now   Reply With Quote
Old 29/05/2020, 08:13 AM   #2
SharpenBlade
Big Clucker
 
Join Date: May 2020
Posts: 175
Reputation: 23
Default Re: Spawn button... skipping it with Spectating doesn't work

Quote:
Originally Posted by hopeonxanny View Post
in these 2 videos you will see what is happening.
https://www.youtube.com/watch?v=PGS-...ature=youtu.be
https://www.youtube.com/watch?v=g3U3...ature=youtu.be

my code:
PHP Code:
public OnPlayerRequestClass(playeridclassid) {
    
    if(
PlayerInfo[playerid][IsLoggedIn]) return SpawnPlayer(playerid);
    
TogglePlayerSpectating(playerid1);
    return 
false;

at login
PHP Code:
            if (strcmp(hashed_passPlayerInfo[playerid][pPassword]) == 0) {
                
cache_set_active(PlayerInfo[playerid][Cache_ID]);
                
AssignPlayerData(playerid);
                
cache_delete(PlayerInfo[playerid][Cache_ID]);
                
PlayerInfo[playerid][Cache_ID] = MYSQL_INVALID_CACHE;
                
KillTimer(PlayerInfo[playerid][LoginTimer]);
                
PlayerInfo[playerid][LoginTimer] = 0;
                
PlayerInfo[playerid][IsLoggedIn] = true;
                
OnPlayerLoginIn(playeridhashed_pass); // this is the next one 
            



PHP Code:
function OnPlayerLoginIn(playerid, const password[]) { // which can be found here
    
TogglePlayerSpectating(playerid0); 
    
SpawnPlayer(playerid);
... 
etc ...etc
i have tried every damn topic on this forum, and it doesn't solve my problem at all. i want to try something else, maybe someone has another idea...
This is wrong.
PHP Code:
public OnPlayerRequestClass(playeridclassid) {
    return 
false;

PHP Code:
public OnPlayerConnect(playerid)
{
    
TogglePlayerSpectating(playerid1);
    return 
1;

PHP Code:
function OnPlayerLoginIn(playerid, const password[])
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
        
TogglePlayerSpectating(playerid0);
    else
        
SpawnPlayer(playerid);

Try this. Also, you should check if the player is spawned with a variable. Under OnPlayerSpawn set it to 1, under OnPlayerDeath set it to 0, also under OnPlayerConnect. Under OnPlayerRequestClass check if the player is spawned and spawn him using SpawnPlayer.
SharpenBlade is offline   Reply With Quote
Old 29/05/2020, 08:14 AM   #3
Runn3R
Huge Clucker
 
Runn3R's Avatar
 
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: Spawn button... skipping it with Spectating doesn't work

Did you SetSpawnInfo?

Normally only toggling PlayerSpectating does the trick of spawning the player back.
Runn3R is offline   Reply With Quote
Old 29/05/2020, 08:25 AM   #4
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,065
Reputation: 106
Default Re: Spawn button... skipping it with Spectating doesn't work

I've had this issue.

This should do it:
pawn Code:
public OnPlayerRequestClass(playerid,classid)
{
    SpawnPlayer(playerid);
    return 1;
}

// after login
SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);

// Set stuff like pos and skin on spawn.
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 29/05/2020, 08:41 AM   #5
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 228
Reputation: 4
Default Re: Spawn button... skipping it with Spectating doesn't work

Quote:
Originally Posted by Runn3R View Post
Did you SetSpawnInfo?

Normally only toggling PlayerSpectating does the trick of spawning the player back.
yes, i did.
as you can see i get the skin & spawn info for pMember = 0. (civilian, no faction)
jasper i will come back with an edit.

EDIT: Now at spawning after correct password it does the trick, but after pressing F4, if the player dies it show like this:
https://i.imgur.com/hmEpmS0.png
__________________
hopeonxanny is online now   Reply With Quote
Old 29/05/2020, 04:18 PM   #6
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 228
Reputation: 4
Default Re: Spawn button... skipping it with Spectating doesn't work

umm... little helpy helpy ?
__________________
hopeonxanny is online now   Reply With Quote
Old 29/05/2020, 05:22 PM   #7
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 275
Reputation: 41
Default Re: Spawn button... skipping it with Spectating doesn't work

Hey there! I can show you my system, just for example.
Or try to avoid this Callback simpler. It’s big amount of ways.
And about your bugs I want to say one thing, try to cut some features one by one and see what’s should be. You can find a reason only this way I think.
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300
Nexotronix is offline   Reply With Quote
Old 30/05/2020, 08:02 AM   #8
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 293
Reputation: 9
Default Re: Spawn button... skipping it with Spectating doesn't work

Code:
function OnPlayerLoginIn(playerid, const password[]) { // which can be found here 
     //do SetSpawnInfo here 
     TogglePlayerSpectating(playerid, 0);  
     //remove spawnplayer
... etc ...etc.
__________________
GameOvr is offline   Reply With Quote
Old 30/05/2020, 10:16 PM   #9
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 228
Reputation: 4
Default Re: Spawn button... skipping it with Spectating doesn't work

Quote:
Originally Posted by GameOvr View Post
Code:
function OnPlayerLoginIn(playerid, const password[]) { // which can be found here 
     //do SetSpawnInfo here 
     TogglePlayerSpectating(playerid, 0);  
     //remove spawnplayer
... etc ...etc.
PHP Code:
function OnPlayerLoginIn(playerid, const password[]) {
    if(
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
        
TogglePlayerSpectating(playerid0);
    else
        
SpawnPlayer(playerid); 
already did that, i am talking about pressing F4, when the player dies, it is put in the char selection menu.
__________________
hopeonxanny is online now   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
Won't work spawn button WiPaS Scripting Help 6 25/08/2012 07:10 PM
My spawn button dosent work... Mikibey Scripting Help 1 02/06/2012 08:18 AM
Changed /enter to F button instead, but doesn't work Knappen Help Archive 2 01/08/2011 02:42 PM
Is there a way to remove the spawn button without spectating? Snoozy1337 Help Archive 5 04/07/2011 02:17 AM
Spectating doesn't work LifeStyle Help Archive 8 29/08/2010 01:50 PM


All times are GMT. The time now is 11:39 PM.


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