09.02.2010, 11:26
hi im trying to get a car anti jack to work in my server as i have having a problem with people stealing peoples cars this is what i got it for some reason it dont work i want it so it kills the driver not the passenger for getting in to
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER && GetPlayerState(playerid) == 5)
{
SetPlayerHealth(playerid, 0);
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "[Anti-Jack]: %s has just been killed for car jacking (n00b!).", pName);
SendClientMessageToAll(red, string);
SendClientMessage(playerid,red,"Error: Car jacking is not allowed!.");
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER && GetPlayerState(playerid) == 5)
{
SetPlayerHealth(playerid, 0);
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "[Anti-Jack]: %s has just been killed for car jacking (n00b!).", pName);
SendClientMessageToAll(red, string);
SendClientMessage(playerid,red,"Error: Car jacking is not allowed!.");
}
}
return 1;
}