salut,sa-mp.ro am nevoie de un pic de ajutor am vazut pe un server te trucking cind iese cnv dp sv scrie ca iesit sii ii zice ca i-a dat cick sau leaving sau lostconection si vr sami fac si io dar nu ma duce capul ,nici nush ce linii sa va pun va pun on player disconected sau cv de genu daca nu ziceti de ce aveti nevoie(poze):
http://postimg.org/image/6um782doj
http://postimg.org/image/57jwgjgu7
[pawn]// This callback gets called when a player disconnects from the server
public OnPlayerDisconnect(playerid, reason)
{
// Always allow NPC's to logout without password or account
if (IsPlayerNPC(playerid))
return 1;
// Setup local variables
new Name[24], Msg[128], HouseID;
// Get the playername
GetPlayerName(playerid, Name, sizeof(Name));
// Stop spectate mode for all players who are spectating this player
for (new i; i < MAX_PLAYERS; i++)
if (IsPlayerConnected(i)) // Check if the player is connected
if (GetPlayerState(i) == PLAYER_STATE_SPECTATING) // Check if this player is spectating somebody
if (APlayerData[spectateID] == playerid) // Check if this player is spectating me
{
TogglePlayerSpectating(i, 0); // Turn off spectate-mode
APlayerData[spectateID] = INVALID_PLAYER_ID;
APlayerData[spectateType] = ADMIN_SPEC_TYPE_NONE;
SendClientMessage(i, 0xFFFFFFFF, "{FF0000}Target player has logged off, ending spectate mode");
}
// Send a message to all players to let them know somebody left the server
Question
Dan_13
salut,sa-mp.ro am nevoie de un pic de ajutor am vazut pe un server te trucking cind iese cnv dp sv scrie ca iesit sii ii zice ca i-a dat cick sau leaving sau lostconection si vr sami fac si io dar nu ma duce capul ,nici nush ce linii sa va pun va pun on player disconected sau cv de genu daca nu ziceti de ce aveti nevoie(poze):
http://postimg.org/image/6um782doj
http://postimg.org/image/57jwgjgu7
[pawn]// This callback gets called when a player disconnects from the server
public OnPlayerDisconnect(playerid, reason)
{
// Always allow NPC's to logout without password or account
if (IsPlayerNPC(playerid))
return 1;
// Setup local variables
new Name[24], Msg[128], HouseID;
// Get the playername
GetPlayerName(playerid, Name, sizeof(Name));
// Stop spectate mode for all players who are spectating this player
for (new i; i < MAX_PLAYERS; i++)
if (IsPlayerConnected(i)) // Check if the player is connected
if (GetPlayerState(i) == PLAYER_STATE_SPECTATING) // Check if this player is spectating somebody
if (APlayerData[spectateID] == playerid) // Check if this player is spectating me
{
TogglePlayerSpectating(i, 0); // Turn off spectate-mode
APlayerData[spectateID] = INVALID_PLAYER_ID;
APlayerData[spectateType] = ADMIN_SPEC_TYPE_NONE;
SendClientMessage(i, 0xFFFFFFFF, "{FF0000}Target player has logged off, ending spectate mode");
}
// Send a message to all players to let them know somebody left the server
format(Msg, 128, TXT_PlayerLeftServer, Name, playerid);
SendClientMessageToAll(0xFFFFFFFF, Msg);
// If the player entered a proper password (the player has an account)
if (strlen(APlayerData[playerid][PlayerPassword]) != 0)
{
// Save the player data and his houses
PlayerFile_Save(playerid);
}[/pawn]
Link to comment
Share on other sites
12 answers to this question
Recommended Posts