Not working :o
#1

When someone disconnects, it only sends everyone a message if the disconnecter is id 0.
Why? -.-
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(PInfo[playerid][Logged] == 1) SaveStats(playerid);
    if(PInfo[playerid][Planting] == 1) DestroyDynamicCP(DrugCP[playerid][0]),PInfo[playerid][Planting] = 0,KillTimer(DrugCP[playerid][1]);
    if(Requester[Requests] != -1) Requester[Requests] = -1, Requests--;
    if(PInfo[playerid][HSeller] != -1) { SendFMessage(PInfo[playerid][HSeller], Yellow, "Your client %s has left the server",GetPName(playerid));}
    if(TrashID[playerid] != -1) RestoreVehicleInfoTD(playerid);
    if(BagID[playerid] != -1) RestoreVehicleInfoTD(playerid);
    switch(reason)
    {
        case 0:SendFMessageToAll(Grey,"%s has left L.A. Noire Cops And Robbers (Crash/Lost Connection)",GetPName(playerid));
        case 1:SendFMessageToAll(Grey,"%s has left L.A. Noire Cops And Robbers (Leaving)",GetPName(playerid));
        case 2:SendFMessageToAll(Grey,"%s has left L.A. Noire Cops And Robbers (Kick/Ban)",GetPName(playerid));
    }
Reply
#2

Try formatting the message instead as sometimes when a player leaves the server cannot process the message quick enough to everyone.
Reply
#3

the disconnect takes place regardless if the script still runs or not. that means: the playername, if useing GetPlayerName(), will fail due to the player already being DCed.
create an array like PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME]; and save the playername when a player connects. later at disconnect, you can depend on the array containing the right name. since the playerid wont change in the OPDC, you can use it as a pointer to the cell:
pawn Код:
format(string,sizeof(string),"%s",PlayerName[playerid]);
edit: i first had in mind that the GetPlayerName() inside the SendClientMessage also fails, coz its stringlenght(name) is undetermined yet. i always use ready-formatted strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)