Here is my OnPlayerDisconnect:
Код:
if(reason == 0)
{
textreason = "Crash";
strmid(PlayerInfo[playerid][pWhyLeft], "Crashed", 0, strlen("Crashed"), 255);
format(string2, sizeof(string2),"%s a quittй le serveur (%s)",plname, textreason);
ProxDetector(30.0, playerid, string2,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
PlayerInfo[playerid][pCrashed] = 1;
UpdatePlayerPosition(playerid);
SaveGuns(playerid);
}
And then my OnPlayerSpawn:
Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
RequestNPCLoad(playerid,npcname);
return 1;
}
PlayerInfo[playerid][SpawnAngle] = 0.0;
KillTimer(PlayerInfo[playerid][SpawnTimer])
MontrerCamera[playerid] = 0;
ScriptMoneyUpdated[playerid] = 1;
SetRealMoney(playerid, ScriptMoney[playerid]);
InitLockDoors(playerid);
STDPlayer[playerid] = 0;
gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Modifie le Genre du joueur
TextDrawHideForPlayer(playerid, TextdrawBarHaut);
TextDrawHideForPlayer(playerid, TextdrawBarBas);
TextDrawHideForPlayer(playerid, TextdrawBienvenue);
if (gTeam[playerid] == 4)
{
gTeam[playerid] = 3;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Le serveur recquiиre une identification. Vous кtes Kick automatiquement");
Kick(playerid);
}
TextDrawHideForPlayer(playerid, Textdraw40[playerid]);
if(gTeam[playerid] == 11 && PlayerInfo[playerid][pLeader] < 1)
{
MedicBill[playerid] = 0;
new rand = random(sizeof(CIV));
SendClientMessage(playerid, COLOR_LIGHTRED, "Vous n'кtes plus un leader approuvй, vous кtes maintenant un civil");
PlayerInfo[playerid][pTeam] = 3;
gTeam[playerid] = 3;
SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
PlayerInfo[playerid][pModel] = PlayerInfo[playerid][pChar];
SpawnPlayer(playerid);
}
if(gTeam[playerid] == 5)
{
if(PlayerInfo[playerid][pMember] < 1)
{
MedicBill[playerid] = 0;
new rand = random(sizeof(CIV));
SendClientMessage(playerid, COLOR_LIGHTRED, "Vous n'кtes pas un membre de la famille, vous кtes maintenant un civil");
PlayerInfo[playerid][pTeam] = 3;
gTeam[playerid] = 3;
SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
PlayerInfo[playerid][pModel] = PlayerInfo[playerid][pChar];
SpawnPlayer(playerid);
}
}
if(gTeam[playerid] == 10)
{
if(PlayerInfo[playerid][pMember] != 8)
{
MedicBill[playerid] = 0;
new rand = random(sizeof(CIV));
SendClientMessage(playerid, COLOR_LIGHTRED, "Vous n'кtes pas un membre de l'agence, vous кtes maintenant un civil");
PlayerInfo[playerid][pTeam] = 3;
gTeam[playerid] = 3;
SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
PlayerInfo[playerid][pModel] = PlayerInfo[playerid][pChar];
SpawnPlayer(playerid);
}
}
if(gTeam[playerid] == 2 && PlayerInfo[playerid][pMember] > 3)
{
MedicBill[playerid] = 0;
new rand = random(sizeof(CIV));
SendClientMessage(playerid, COLOR_LIGHTRED, "Vous n'avez pas membre du F.B.I, Garde nationale, vous кtes maintenant un civil");
PlayerInfo[playerid][pTeam] = 3;
gTeam[playerid] = 3;
SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
PlayerInfo[playerid][pModel] = PlayerInfo[playerid][pChar];
SpawnPlayer(playerid);
}
if(PlayerInfo[playerid][pChar] > 0) { SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]); }
else { SetPlayerSkin(playerid, 230); }
SetPlayerWeapons(playerid);
SetPlayerSpawn(playerid);
SetPlayerToTeamColor(playerid);
PlayerFixRadio(playerid);
IsCopBanned(playerid);
for(new i = 0; i < sizeof(Turfs); i++)
{
GangZoneShowForPlayer(playerid, i, TurfInfo[i][zColor]);
GangZoneShowForPlayer(playerid, TerritoireVagos, 0xFBFF59AA);
GangZoneShowForPlayer(playerid, TerritoireSurenos, 0x95FFF4AA);
GangZoneShowForPlayer(playerid, TerritoireBallas, 0xFF7DFFAA);
GangZoneShowForPlayer(playerid, TerritoireGroove, 0x46FF50AA);
return 1;
}
return 1;
}
And finally my SetPlayerSpawn Crash:
Код:
if(PlayerInfo[playerid][pCrashed] == 1)
{
new string[500];
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVirWorld]);
SafeSetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
SafeSetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 1);
format(string, sizeof(string),"%s est entrй en ville (Du Crash)",plname);
ProxDetector(50.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
SetPlayerToTeamColor(playerid);
SetPlayerWeapons(playerid);
return 1;
}