01.07.2015, 22:02
Here you go:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
// Vehicle hack detection
if(USE_ANTI_VEHICLE_HACK == true)
{
if(IsPlayerInAnyVehicle(playerid) || newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
pVehicles[playerid]++;
SetTimerEx("VehicleEnterReset", 3000, 0, "i", playerid);
if(pVehicles[playerid] >= MAX_ENTER_VEHICLES && GetPlayerVirtualWorld(playerid) != 1718)
{
SetTimerEx("UnsetKick", 500, 0, "i", playerid);
}
}
}
if( newstate == PLAYER_STATE_DRIVER )
{
if( GetVehicleModel( GetPlayerVehicleID( playerid )) == 520 )
{
if(GetPlayerScore(playerid) < 4500)
{
RemovePlayerFromVehicle( playerid );
GameTextForPlayer( playerid, "~r~~h~4500+~b~ Score Needed For Hydra!", 3000, 3 );
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
if((GetTickCount()-GetPVarInt(playerid, "cartime")) < 1000) // enters veh as driver faster than 1 once
{
SetPVarInt(playerid, "carspam", GetPVarInt(playerid, "carspam")+1);
if(GetPVarInt(playerid, "carspam") >= 5) // allows 5 seconds leeway to compensate for glitching, then kicks
{
new name[24];
new string128[128];
GetPlayerName(playerid,name,24);
format(string128,sizeof(string128),"[hack][carspam] Kicked [%i]%s for CAR SPAM hacks",playerid,name);
SendClientMessageToAll(0xFFFF00AA,string128);
printf(string128);
return Kick(playerid);
}
}
SetPVarInt(playerid, "cartime", GetTickCount());
}
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
if(pInfo[playerid][VGod] == 1)
{
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid),20000);
SendClientMessage(playerid,yellow,"You are no vehicle damage mode on, if you want to turn off it type /godcar again!");
}
foreach(Player, i)
{
if(pInfo[i][Spec] == 1 && GetPlayerState(i) == PLAYER_STATE_SPECTATING && Specid[i] == playerid)
{
SetPlayerInterior(i,GetPlayerInterior(playerid));
SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
#if SpecTextDraw == true
UpdteSpecTD(i,playerid);
#endif
PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
}
}
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
foreach(Player, i)
{
if (Specid[i] == playerid && pInfo[i][Spec] == 1 && GetPlayerState(i) == PLAYER_STATE_SPECTATING)
{
SetPlayerInterior(i,GetPlayerInterior(playerid));
SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
#if SpecTextDraw == true
UpdteSpecTD(i,playerid);
#endif
TogglePlayerSpectating(i, 1);
PlayerSpectatePlayer(i, playerid);
}
}
}
if(pInfo[playerid][VGod] == 1 && oldstate == PLAYER_STATE_DRIVER)
{
SetVehicleHealth(GetPVarInt(playerid,"CarID"),1000);
}
if(pInfo[playerid][Locked] == 1 && oldstate == PLAYER_STATE_DRIVER)
{
foreach(Player, i)
SetVehicleParamsForPlayer(GetPVarInt(playerid,"CarID"),i,false,false);
pInfo[playerid][Locked] = 0;
Delete3DTextLabel(vLocked3DT[playerid]);
}
return 1;
}