- Регистрация
- 9 Дек 2017
- Сообщения
- 306
- Лучшие ответы
- 0
- Репутация
- 2
вшил античит nex-ac и столкнулся с проблемой смерти при спавне
OnPlayerSpawn
PHP:
public OnPlayerSpawn(playerid)
{
if(!IsPlayerConnected(playerid)) return 1;
if(!PlayerInfo[playerid][pLogin]) return SendClientMessage(playerid, COLOR_WHITE, "Необходимо авторизоваться!"), KickEx(playerid);
if(GetPVarInt(playerid, "ShowKey")) return SendClientMessage(playerid, COLOR_WHITE, "Вы не ввели ключ безопасности!"), KickEx(playerid);
SetPVarInt(playerid,"Crasher",gettime()+30);
SetPVarInt(playerid,"SpawnPlayer",true);
DeletePVar(playerid, "K_Times");
GetPlayerPos(playerid,PlayerPos[playerid][0],PlayerPos[playerid][1],PlayerPos[playerid][2]);
PosTime[playerid] += 3 + floatround(GetPlayerPing(playerid)/100);
SetPlayerHealth(playerid, 100.0);
SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,990);
SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,990);
SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,990);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid,0);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerColor(playerid, FractionInfo[PlayerInfo[playerid][pMember]][fColor]);
if(DeathMatch{playerid})return SpawnDeathMatch(playerid); // если игрок убит в ДМ зоне то его туда же
if(PlayerInfo[playerid][pMember])
{
if(StartRabWork(playerid) && !GetPVarInt(playerid,"StartRabWork")) SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
else SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
else SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
DisablePlayerCheckpoint(playerid);
if(GetPVarInt(playerid, "GunLoading"))
{
for ( new i ; i < 13 ; i ++ )
{
if ( !PlayerInfo [ playerid ] [ pGun ] [ i ] || !PlayerInfo [ playerid ] [ pAmmo ] [ i ] ) continue ;
GivePlayerWeaponAC ( playerid, PlayerInfo [ playerid ] [ pGun ] [ i ], PlayerInfo [ playerid ] [ pAmmo ] [ i ] ) ;
}
new gun_string[56], ammo_string[56];
format ( gun_string, 56, "0,0,0,0,0,0,0,0,0,0,0,0,0");
format ( ammo_string, 56, "0,0,0,0,0,0,0,0,0,0,0,0,0");
string="";
mysql_format(connects, string, 256, "UPDATE `accounts` SET `p_guns` = '%s',`p_ammo` = '%s' WHERE `id` = '%i' LIMIT 1", gun_string, ammo_string, PlayerInfo [ playerid ] [ pID ] ) ;
mysql_empty(connects, string);
DeletePVar(playerid, "GunLoading");
}
for(new index = 0; index < MAX_PLAYER_ATTACHED_OBJECTS; index++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, index))
{
RemovePlayerAttachedObject(playerid, index);
}
if(!PLAYER_AO[playerid][index][g_modelid]) continue;
SetPlayerAttachedObject(playerid,index,PLAYER_AO[playerid][index][g_modelid],PLAYER_AO[playerid][index][g_boneid],
PLAYER_AO[playerid][index][g_fOffsetX],PLAYER_AO[playerid][index][g_fOffsetY],PLAYER_AO[playerid][index][g_fOffsetZ],
PLAYER_AO[playerid][index][g_fRotX],PLAYER_AO[playerid][index][g_fRotY],PLAYER_AO[playerid][index][g_fRotZ]);
}
if(PlayerInfo_MP_START{playerid}) return GiveStatus_MP(playerid, GetPVarInt(playerid,"PlayerInfo_MP_Staus"));
if(GetPVarInt(playerid, "Spectate") && GetPVarInt(playerid, "SpectateID") != -1)
{
SetPlayerPosEx(playerid, gPlayerPosition[playerid][0],gPlayerPosition[playerid][1],gPlayerPosition[playerid][2]);
SetPlayerInterior(playerid, gPlayerInformation[playerid][0]);
SetPlayerVirtualWorld(playerid, gPlayerInformation[playerid][1]);
DeletePVar(playerid, "Spectate"), SetPVarInt(playerid, "SpectateID", -1);
TextDrawHideForPlayer(playerid, ReconText);
PlayerTextDrawDestroy(playerid, PlayerText:ReconPlayerText[playerid][0]);
PlayerTextDrawDestroy(playerid, PlayerText:ReconPlayerText[playerid][1]);
return 1;
}
if(PlayerInfo[playerid][pPrisonTime]>0)
{
SetPlayerVirtualWorld(playerid,1);
SetPlayerInterior(playerid, 0);
SetPlayerPosEx(playerid,5512.0884,1243.8398,23.1886);
SetPlayerFacingAngle(playerid, 179.7971);
return 1;
}
if(PlayerInfo[playerid][pJailTime]>0)
{
if(PlayerInfo[playerid][pMestoJail] == 1)
{
SetPlayerInterior(playerid, 6);
SetPlayerPosEx(playerid,264.1425,77.4712,1001.0391);
SetPlayerFacingAngle(playerid, 263.0160);
return 1;
}
if(PlayerInfo[playerid][pMestoJail] == 2)
{
SetPlayerInterior(playerid, 10);
SetPlayerPosEx(playerid,219.5400,109.9767,999.0156);
SetPlayerFacingAngle(playerid, 1.0000);
return 1;
}
if(PlayerInfo[playerid][pMestoJail] == 3)
{
SetPlayerInterior(playerid, 3);
SetPlayerPosEx(playerid,198.3642,161.8103,1003.0300);
SetPlayerFacingAngle(playerid, 1.0000);
return 1;
}
}
if(PlayerInfo[playerid][pHospital])
{
FreezePlayer(playerid, (GetPlayerPing(playerid) > 100 ? (3500) : (2000)));
new randomspawn = RandomEx(0,13);
SetPlayerPosEx(playerid, SpawnAmbulance[randomspawn][0], SpawnAmbulance[randomspawn][1], SpawnAmbulance[randomspawn][2]);
pTemp[playerid][pInHospital] = true;
SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "PlayerHospital_VirtualWorld"));
DeletePVar(playerid, "PlayerHospital_VirtualWorld");
SetPlayerInterior(playerid, 0);
SetPlayerHealth(playerid, 10.0);
return 1;
}
if((PlayerInfo[playerid][pHouse] != -1 || PlayerInfo[playerid][pArendaHouse] != -1) && PlayerInfo[playerid][pSpawn] == 1)
{
FreezePlayer(playerid, (GetPlayerPing(playerid) > 100 ? (3500) : (2000)));
new house;
if(PlayerInfo[playerid][pHouse] != -1) house = PlayerInfo[playerid][pHouse];
else house = PlayerInfo[playerid][pArendaHouse];
SetPlayerInterior(playerid,HouseInfo[house][hInt]);
SetPlayerPosEx(playerid, HouseInfo[house][hExit][0], HouseInfo[house][hExit][1],HouseInfo[house][hExit][2]); // Warp the player
SetPlayerVirtualWorld(playerid, house+50);
SetPVarInt(playerid, "HouseID", house);
return 1;
}
if(PlayerInfo[playerid][bAdmin] && !PlayerInfo[playerid][pSpawn])
{
SetPlayerPosEx(playerid, 3315.1279,2307.9993,36.9669);
SetPlayerFacingAngle(playerid, 270.7839);
FreezePlayer(playerid, (GetPlayerPing(playerid) > 100 ? (3500) : (2000)));
SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0);
return 1;
}
if(PlayerInfo[playerid][pCar][0] == 508)
{
if(PlayerInfo[playerid][pSpawn])
{
SetPlayerPosEx(playerid, 2531.7166,-1031.2251,54.0299);
FreezePlayer(playerid, (GetPlayerPing(playerid) > 100 ? (3500) : (2000)));
SetPlayerFacingAngle(playerid, 0);
SetPlayerVirtualWorld(playerid,caridhouse[playerid][0]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 1);
SetPVarInt(playerid, "Intropic", caridhouse[playerid][0]);
return 1;
}
}
new frac = PlayerInfo[playerid][pMember];
FreezePlayer(playerid, (GetPlayerPing(playerid) > 100 ? (3500) : (2000)));
SetPlayerPosEx(playerid, FractionInfo[frac][fPosX],FractionInfo[frac][fPosY],FractionInfo[frac][fPosZ]);
SetPlayerFacingAngle(playerid, FractionInfo[frac][fPosA]);
SetSpawnInfoEx(playerid, (!frac?(PlayerInfo[playerid][pChar]):(PlayerInfo[playerid][pModel])), FractionInfo[frac][fPosX], FractionInfo[frac][fPosY], FractionInfo[frac][fPosZ], FractionInfo[frac][fPosA]);
SetPlayerInterior(playerid, FractionInfo[frac][fractionInt]);
SetPlayerVirtualWorld(playerid, FractionInfo[frac][fractionVirt]);
switch(PlayerInfo[playerid][pMember])
{
case 3,20,27: SetPlayerCheckpoint(playerid, -1636.9213,608.1162,-51.8141-1, 1.0), SetPVarInt(playerid, "gps_pic", 1);
case 16: lNews[playerid] = false;
case 6: SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
case 14: SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
case 4: pTemp[playerid][pInHospital] = true;
case 12: SetPlayerCheckpoint(playerid, -71.5424,1366.1405,1080.2185,1.0);
case 13: SetPlayerCheckpoint(playerid, 300.4856,302.5443,1003.5391,1.0);
case 17: SetPlayerCheckpoint(playerid, -45.9193,1401.2159,1084.4370,1.0);
case 18: RemovePlayerAttachedObject(playerid, 1), SetPlayerCheckpoint(playerid,-219.9765,1406.8613,27.7656,1.0);
case 15: SetPlayerCheckpoint(playerid,2492.0986,-1710.9407,1014.7422,1.0);
}
return 1;
}
OnPlayerGiveDamage
PHP:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
new Float:Dmg[3];
GetPlayerArmour(damagedid, Dmg[1]);
GetPlayerHealth(damagedid, Dmg[0]);
if(Dmg[1] > 0)
{
if(amount > Dmg[1])
{
Dmg[2] = amount - Dmg[1];
Dmg[0] = Dmg[0] - Dmg[2];
SetPlayerArmour(damagedid, 0.0);
return SetPlayerHealth(damagedid, Dmg[0]);
}
Dmg[1] = Dmg[1] - amount;
SetPlayerArmour(damagedid, Dmg[1]);
}
if(Dmg[1] < 1)
{
Dmg[0] = Dmg[0] - amount;
SetPlayerHealth(damagedid, Dmg[0]);
}
else if(PlayerInfo[playerid][bAdmin] && PlayerInfo[playerid][pGM]) return 0;
if(IsACop(playerid) && weaponid == 3 && IsPlayerConnected(damagedid) && !IsACop(damagedid))
{
if(GetPVarInt(damagedid, #tazer_dest)) return SendClientMessage(playerid, -1, ""#net"Игрок уже оглушен!");
TogglePlayerControllable(damagedid, false);
ClearAnimations(damagedid);
ApplyAnimation(damagedid,"PED","KO_skid_front",4.1,0,1,1,1,0);
format(string, 76, "%s оглушил %s",PlayerInfo[playerid][pNames],PlayerInfo[damagedid][pNames]);
ProxDetector(30.0,playerid,string,0xDD90FFFF,0xDD90FFFF,0xDD90FFFF);
SetTimerEx("TazedTimer", 8000, false, "i", damagedid);
SetPVarInt(damagedid, #tazer_dest, true);
}
return 1;
}
OnPlayerTakeDamage
PHP:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID && (weaponid >= 22 && weaponid <= 32))
{
new Float: hp; GetPlayerHealth(playerid,hp);
new Float: ar; GetPlayerArmour(playerid,ar);
if(hp >= OldHealth[playerid] && ar == 0.0 || ar >= OldArmour[playerid]) Shot_AntiGM_Total[playerid]++;
else Shot_AntiGM_Total[playerid] = 0;
if(Shot_AntiGM_Total[playerid] == 3) Shot_AntiGM_Total[playerid] = 0, OnPlayerCheat(playerid,AC_GM_2_CODE,AC_SEND);
GetPlayerHealth(playerid,OldHealth[playerid]), GetPlayerHealth(playerid,OldArmour[playerid]);
}
if(issuerid == INVALID_PLAYER_ID) return 1;
PlayerPlaySound(issuerid,17802,0,0,0);
return 1;
}