SA-MP Forums Archive
Problem OnPlayerDisconnect - 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: Problem OnPlayerDisconnect (/showthread.php?tid=328708)



Problem OnPlayerDisconnect - TheBluec0de - 25.03.2012

Dosent appear in chat... why ?

OnPlayerDisconnect:

Quote:

switch(reason)
{
case 0: format(String, sizeof String, "%s (ID:%d) Quit (Crash)", NameEx(playerid), playerid);
case 1: format(String, sizeof String, "%s (ID:%d) Quit (leaving)", NameEx(playerid), playerid);
case 2:
{
format(String, sizeof String, "%s (ID:%d) quit (kick/Ban)", NameEx(playerid), playerid);
PlayCrimeReportForPlayer(playerid, playerid, 3);
}
}
SendClientMessageToAll(-1, String);

Stock:

Quote:

stock NameEx(playerid)
{
new
Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}




Re: Problem OnPlayerDisconnect - .FuneraL. - 25.03.2012

Replace with This :

pawn Код:
new pName[MAX_PLAYER_NAME];
    new string[566];
    GetPlayerName(playerid, pName, sizeof(pName));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "{828282}===> %s Leaving The Server [ Connection Problem / Crash ] <===", pName);
        case 1: format(string, sizeof(string), "{828282}===> %s Leaving The Server [ Leaving ] <===", pName);
        case 2: format(string, sizeof(string), "{828282}===> %s Leaving The Server [ Kicked / Banned ] <===", pName);
    }
    SendClientMessageToAll(0xBBC8CBAA, string);



Re: Problem OnPlayerDisconnect - TheBluec0de - 25.03.2012

Resolve to my code...


Re: Problem OnPlayerDisconnect - ReneG - 25.03.2012

define "String"
Код:
new String[50];
Under OnPlayerDisconnect.


Re: Problem OnPlayerDisconnect - TheBluec0de - 25.03.2012

I have already defined the string


Re: Problem OnPlayerDisconnect - .FuneraL. - 25.03.2012

What is wrong, does not appear in the chat?


Re: Problem OnPlayerDisconnect - TheBluec0de - 25.03.2012

does not appear in the chat, yes


Re: Problem OnPlayerDisconnect - TheBluec0de - 25.03.2012

help ?


Re: Problem OnPlayerDisconnect - .FuneraL. - 25.03.2012

pawn Код:
switch(reason)
{
case 0: format(String, sizeof String, "%s (ID:%d) Quit (Crash)", NameEx(playerid), playerid);
case 1: format(String, sizeof String, "%s (ID:%d) Quit (leaving)", NameEx(playerid), playerid);
case 2: format(String, sizeof String, "%s (ID:%d) quit (kick/Ban)", NameEx(playerid), playerid);
PlayCrimeReportForPlayer(playerid, playerid, 3);
}
SendClientMessageToAll(-1, String);
Try So who knows.


Re: Problem OnPlayerDisconnect - Twisted_Insane - 25.03.2012

This will work for sure:

pawn Код:
public OnPlayerDisconnect(playerid, reason) {

        new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        switch(reason)
        {
            case 0: format(string, sizeof(string), "* Player %s has left the server! (Timeout) *", pname);
            case 1: format(string, sizeof(string), "* Player %s has left the server! (Leaving) *", pname);
            case 2: format(string, sizeof(string), "* Player %s has left the server! (Kicked/Banned) *", pname);
        }
        SendClientMessageToAll(0xAAAAAAAA, string);
// rest of your callback here