SA-MP Forums Archive
HOW TO DO THIS - 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: HOW TO DO THIS (/showthread.php?tid=283684)



HOW TO DO THIS - [MKD]Max - 16.09.2011

How i can make when player click on cancel in dialog give another reason For Ex


Someone(1) Has left the server (Leaving)


how i can do this its always say Kicked


Re: HOW TO DO THIS - [MG]Dimi - 16.09.2011

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new
        
string[64],
        
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(
reason)
    {
        case 
0format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 
1format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 
2format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
    }
    
SendClientMessageToAll(0xFFFFFFAA,string);
    return 
1;

Note: Copied from wiki!

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


Re: HOW TO DO THIS - [MKD]Max - 16.09.2011

i know this i got them all in my script but what i want when player click on Quit in dialog show him like that message


%s left the server. (Leaving)


Re: HOW TO DO THIS - [MG]Dimi - 16.09.2011

Only if you script it personally or try
PHP код:
//OnDialogResponse
if(!respondOnPlayerCommandText(playerid,"/q"); 
Just not sure can you call default sa-mp commands :/


Re: HOW TO DO THIS - [MKD]Max - 16.09.2011

Its not work stay tell me unknown command


Re: HOW TO DO THIS - Pharrel - 16.09.2011

you cant close the players client... the max you can do is kick the player and force him to quit.


Re: HOW TO DO THIS - [MG]Dimi - 16.09.2011

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
you cant close the players client... the max you can do is kick the player and force him to quit.
And that won't give him effect he wants.

@Max, create variable for player and then if he responded quit you will send message that he left, else you would send message Kicked

EDIT: SOmething like this.
NOTE: UNTESTED
PHP код:
//top of the script
new bool:Quited[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{
    new
        
string[64],
        
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(
reason)
    {
        case 
0format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 
1format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 
2:
        {
            if(
Quited[playerid] == true)
            {
                
format(string,sizeof string,"%s left the server. (Leaving)",name);
            }
            else 
format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
        }
    }
    
SendClientMessageToAll(0xFFFFFFAA,string);
    return 
1;
}
//OnDialogResponse
if(!reason)
{
    
Quited[playerid] = true;
    
Kick(playerid);
    return 
1;




Re: HOW TO DO THIS - [MKD]Max - 16.09.2011

Thanks man its fucking work man thank you very much you are very nice!! i give you repuation