if(IsACopCar(newcar)) { if(IsACop(playerid)) { if(OnDuty[playerid] != 1) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "You are not on duty."); } } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "This vehicle is locked to group Los Santos Police Department."); } } if(IsAFbiCar(newcar)) { if(IsACop(playerid)) { if(OnDuty[playerid] != 1) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "You are not on duty."); } } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "This vehicle is locked to group Federal Bureau of Investigations."); } } if(IsALVPDCar(newcar)) { if(IsACop(playerid)) { if(OnDuty[playerid] != 1) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "You are not on duty."); } } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "This vehicle is locked to group Las Venturas Police Department."); } } if(IsANgCar(newcar)) { if(IsACop(playerid)) { if(OnDuty[playerid] != 1) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "You are not on duty."); } } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_WHITE, "This vehicle is locked to group National Guard."); } }
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z);//Gets players position SetPlayerPos(playerid, X, Y, Z+5);//Adds 5 to players Z coord, also slaps the player. Change 5 to what you think is good.
So you want a player to get slapped if he/she tries to enter a car from another faction?
Just check for the vehicle in OnPlayerEnterVehicle https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle and add this: Код:
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z);//Gets players position SetPlayerPos(playerid, X, Y, Z+5);//Adds 5 to players Z coord, also slaps the player. Change 5 to what you think is good. |
//add this on top of the script under other new/static statements new SlapCD[MAX_PLAYERS]; new slapped[MAX_PLAYERS]; //after setting players position add this TogglePlayerControllable(playerid, false); SlapCD[playerid] = gettime() + 4; slapped[playerid] = 1; //under OnPlayerUpdate: if(SlapCD[playerid] <= gettime() && slapped[playerid] == 1) { TogglePlayerControllable(playerid, true); slapped[playerid] = 0; } //Add this under OnPlayerConnect: slapped[playerid] = 0; SlapCD[playerid] = 0;