SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 22/01/2015, 07:47 PM   #1
iFiras
Huge Clucker
 
iFiras's Avatar
 
Join Date: Oct 2013
Location: Tunisia
Posts: 487
Reputation: 38
Default Small Issue

So basically, I've been facing a problem, it's when I turn off the spectating mode, the server closes the connection. Let me describe what I wanted to do.
I wanted to disable the class selection (spawn buttons) and put a dialog instead.
After the player's logged in to the server, it puts him/her in the spectating mode and when the player attempts to spawn (using the dialog I made), the server closes the connection.

Code:
pawn Code:
if(dialogid == DIALOG_SELECT)
{
    if(!response)
    {
        KickPlayer(playerid,500);
    }
    else
    {
        if(listitem == 0)
        {
            TogglePlayerSpectating(playerid, false); // At this point, the server closes the connection.
            SetPlayerTeam(playerid, 0);
        }
    }
}

I don't know if you understood what I mean but I hope you did.
iFiras is offline   Reply With Quote
Old 22/01/2015, 08:29 PM   #2
Riso135
Big Clucker
 
Join Date: Apr 2011
Location: Bratislava/Slovakia
Posts: 94
Reputation: 8
Default Re: Small Issue

try this...

Quote:
if(dialogid == DIALOG_SELECT)
{
if(response)
{
if(listitem == 0)
{
TogglePlayerSpectating(playerid, false);
SetPlayerTeam(playerid, 0);
}
}
else if(!response)
{
KickPlayer(playerid,500);
}
}
Riso135 is offline   Reply With Quote
Old 23/01/2015, 11:34 AM   #3
iFiras
Huge Clucker
 
iFiras's Avatar
 
Join Date: Oct 2013
Location: Tunisia
Posts: 487
Reputation: 38
Default Re: Small Issue

Quote:
Originally Posted by Riso135 View Post
try this...
Same thing, doesn't work.
I just noticed that the server closes the connection by itself, I removed that "KickPlayer" function and tried again and the same thing just keeps happening, must be a SA-MP bug.
iFiras is offline   Reply With Quote
Old 23/01/2015, 11:38 AM   #4
Runn3R
Huge Clucker
 
Runn3R's Avatar
 
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: Small Issue

Try removing SetPlayerTeam?
Runn3R is offline   Reply With Quote
Old 23/01/2015, 12:03 PM   #5
iFiras
Huge Clucker
 
iFiras's Avatar
 
Join Date: Oct 2013
Location: Tunisia
Posts: 487
Reputation: 38
Default Re: Small Issue

Quote:
Originally Posted by Runn3R View Post
Try removing SetPlayerTeam?
Same thing.
I added SpawnPlayer(playerid);.
Code:
pawn Code:
if(dialogid == DIALOG_SELECT)
{
    if(!response)
    {
        KickPlayer(playerid,500);
    }
    else
    {
        if(listitem == 0)
        {
            SpawnPlayer(playerid);
            TogglePlayerSpectating(playerid, false);
            SetPlayerTeam(playerid, 0);
        }
    }
}
It worked though but OnPlayerSpawn gets called twice and I kinda dislike that because messages get sent again and that would cause spam.
Is there any other way I can do this?
iFiras is offline   Reply With Quote
Old 23/01/2015, 12:30 PM   #6
Ciarannn
Big Clucker
 
Join Date: Feb 2014
Posts: 195
Reputation: 15
Default Re: Small Issue

I don't know if this will make a difference, but you may as well try it:

pawn Code:
if(dialogid == DIALOG_SELECT)
{
    if(!response) return KickPlayer(playerid,500);
    if(reponse)
    {
        if(listitem == 0)
        {
            SpawnPlayer(playerid);
            TogglePlayerSpectating(playerid, false);
            SetPlayerTeam(playerid, 0);
            return 1;
        }
    }
}
__________________
If it's stupid and it works, it ain't stupid.
Ciarannn is offline   Reply With Quote
Old 24/01/2015, 04:04 PM   #7
iFiras
Huge Clucker
 
iFiras's Avatar
 
Join Date: Oct 2013
Location: Tunisia
Posts: 487
Reputation: 38
Default Re: Small Issue

Quote:
Originally Posted by Ciarannn View Post
I don't know if this will make a difference, but you may as well try it:

pawn Code:
if(dialogid == DIALOG_SELECT)
{
    if(!response) return KickPlayer(playerid,500);
    if(reponse)
    {
        if(listitem == 0)
        {
            SpawnPlayer(playerid);
            TogglePlayerSpectating(playerid, false);
            SetPlayerTeam(playerid, 0);
            return 1;
        }
    }
}
Does not work...
iFiras is offline   Reply With Quote
Old 24/01/2015, 06:29 PM   #8
Ciarannn
Big Clucker
 
Join Date: Feb 2014
Posts: 195
Reputation: 15
Default Re: Small Issue

Quote:
Originally Posted by iFiras View Post
Does not work...
I misspelt response in the if(response), try again after fixing it.
__________________
If it's stupid and it works, it ain't stupid.
Ciarannn is offline   Reply With Quote
Old 24/01/2015, 06:42 PM   #9
iFiras
Huge Clucker
 
iFiras's Avatar
 
Join Date: Oct 2013
Location: Tunisia
Posts: 487
Reputation: 38
Default Re: Small Issue

Quote:
Originally Posted by Ciarannn View Post
I misspelt response in the if(response), try again after fixing it.
I already did, I've noticed that already.
What I don't understand is that the server closes the connection after turning the spectating mode off.
Did someone else encounter this before?
iFiras 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
Small Issue! Ciandlah Scripting Help 2 28/04/2013 07:29 AM
Small Issue [rG]Cold Scripting Help 2 14/10/2012 04:02 PM
Small issue MP2 Scripting Help 2 08/03/2012 09:46 PM
[help] I HAve An Very Small Issue [not Error] Issue HayZatic Help Archive 1 06/07/2011 04:33 AM
A Small Issue TKZ227 Help Archive 0 24/05/2010 02:43 PM


All times are GMT. The time now is 04:31 PM.


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