PPC_Trucking módról lenne szó azt szeretném meg tudni hogy a rendõr és a pizzás küldetéseket(munkákat hogyan lehetne beállítani hogy többet keressenek és itt vannak a kódok
Ez a pizzás
forward Courier_VehicleTimer(playerid);
// This function gets called whenever a courier player enters \"/work\"
Courier_StartJob(playerid)
{
// Setup local variables
new HouseCounter, HousesInRange[200], DialogList[200];
// First clear the house-list
for (new i; i < 11; i++)
APlayerData[playerid][CourierHouses] = 0;
// Count how many owned houses are in range of the player
for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
// Check if the house is owned
if (AHouseData[HouseID][Owned] == true)
{
// Check if the house is in range of the player
if (IsPlayerInRangeOfPoint(playerid, CourierJobRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
// Check if there aren\'t 200 in-range houses have been found yet
if (HouseCounter < 200)
{
HousesInRange[HouseCounter] = HouseID; // Store the HouseID in the list of in-range houses
HouseCounter++; // Increase the number of owned houses in range of the player (range = 1000 meters)
}
else
{
break; // Stop searching for more houses (200 is the maximum)
}
}
}
}
// Abort the mission if there are less than 2 houses in range and inform the player
if (HouseCounter < 2)
{
SendClientMessage(playerid, 0xAA3333AA, \"{FF0000}Nincs elég ház megvéve.Nem tudod hova szállítani a csomagokat.\");
return 0;
}
// Try to add the 3 lines to the dialog-list
if (HouseCounter >= 2)
{
format(DialogList, sizeof(DialogList), \" szállits 2 csomagot\\n\"); // Add the line to the dialog
APlayerData[playerid][CourierMaxStep] = 2; // Set the number of houses for the job to 2
}
if (HouseCounter >= 5)
{
format(DialogList, sizeof(DialogList), \"%s szállits 5 csomagot\\n\", DialogList); // Add the line to the dialog
APlayerData[playerid][CourierMaxStep] = 5; // Set the number of houses for the job to 5
}
if (HouseCounter >= 10)
{
format(DialogList, sizeof(DialogList), \"%s szállits 10 csomagot\\n\", DialogList); // Add the line to the dialog
APlayerData[playerid][CourierMaxStep] = 10; // Set the number of houses for the job to 10
}
// Choose a random house for the first house to visit
APlayerData[playerid][CourierHouses][1] = HousesInRange[random(HouseCounter)];
// Now choose as many houses randomly as allowed, starting from the second
for (new i = 2; i <= APlayerData[playerid][CourierMaxStep]; i++)
{
// Copy a random HouseID from the prepared list on in-range houses to the job-list
APlayerData[playerid][CourierHouses] = HousesInRange[random(HouseCounter)];
// If the HouseID is the same as the previous HouseID (the player would visit the same house twice in a row)
while (APlayerData[playerid][CourierHouses][i - 1] == APlayerData[playerid][CourierHouses])
APlayerData[playerid][CourierHouses] = HousesInRange[random(HouseCounter)]; // Get a new random HouseID as long as the HouseID is the same as the previous one
}
// Let the player choose how many packages he wants to deliver
ShowPlayerDialog(playerid, DialogCourierSelectQuant, DIALOG_STYLE_LIST, \"Choose how many packages you want to deliver\", DialogList, TXT_DialogButtonSelect, \"Vissza\");
return 1;
}
// This function is called when the player has chosen how many packages he wants to deliver
Courier_BeginJob(playerid)
{
// Setup local variables
new RouteText[128], Step, HouseID, Float:x, Float:y, Float:z;
// Job has started
APlayerData[playerid][JobStarted] = true;
// Store the vehicleID (required to be able to check if the player left his vehicle)
APlayerData[playerid][VehicleID] = GetPlayerVehicleID(playerid);
// Set jobstep to 1 (going to the first house)
Step = 1;
APlayerData[playerid][JobStep] = Step;
// Get the HouseID of the house where the mission starts (the first house in the list of in-range owned house)
HouseID = APlayerData[playerid][CourierHouses][step];
// Set the TextDraw so the player can see it
format(RouteText, 255, \"~w~Deliver package ~b~%i/%i~w~ to: ~r~%s\", Step, APlayerData[playerid][CourierMaxStep], AHouseData[HouseID][HouseName]);
TextDrawSetString(APlayerData[playerid][MissionText], RouteText);
// Grab the x, y, z positions for the first location
x = AHouseData[HouseID][HouseX];
y = AHouseData[HouseID][HouseY];
z = AHouseData[HouseID][HouseZ];
// Create a checkpoint where the player should deliver his package
SetPlayerCheckpoint(playerid, x, y, z, 3);
// Start a timer that ticks every second to see if the player is still inside his vehicle
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
APlayerData[playerid][VehicleTimer] = SetTimerEx(\"Courier_VehicleTimer\", 1000, true, \"d\" , playerid);
// Send the player a message to inform him that the mission has started
SendClientMessage(playerid, 0xAA3333AA, \"{00FF00}Deliver packages to player\'s houses\");
return 1;
}
// This function is called when a courier enters a checkpoint
Courier_OnPlayerEnterCheckpoint(playerid)
{
// Setup local variables
new RouteText[128], Step, HouseID, Float:x, Float:y, Float:z, Name[24], Msg[128], Payment;
// Check if the player is outside his vehicle while entering a checkpoint
if (GetPlayerVehicleSeat(playerid) == -1)
{
// Check if all the packages haven\'t been delivered
if (APlayerData[playerid][CourierMaxStep] != APlayerData[playerid][JobStep])
{
// First disable the current checkpoint
DisablePlayerCheckpoint(playerid);
// Let the player know he delivered a package
GameTextForPlayer(playerid, \"Leszálítottál egy csomagot\", 5000, 4);
SendClientMessage(playerid, 0xAA3333AA, \"Leszálitottál egy csomagot\");
// Set next JobStep (next house)
APlayerData[playerid][JobStep]++;
Step = APlayerData[playerid][JobStep];
// Get the HouseID of the house where the mission starts (the first house in the list of in-range owned house)
HouseID = APlayerData[playerid][CourierHouses][step];
// Set the TextDraw so the player can see it
format(RouteText, 255, \"~w~Deliver package ~b~%i/%i~w~ to: ~r~%s\", Step, APlayerData[playerid][CourierMaxStep], AHouseData[HouseID][HouseName]);
TextDrawSetString(APlayerData[playerid][MissionText], RouteText);
// Grab the x, y, z positions for the first location
x = AHouseData[HouseID][HouseX];
y = AHouseData[HouseID][HouseY];
z = AHouseData[HouseID][HouseZ];
// Create a checkpoint where the player should deliver his package
SetPlayerCheckpoint(playerid, x, y, z, 3);
}
else // All packages have been delivered, the player has to get paid now
{
// Get the player name
GetPlayerName(playerid, Name, sizeof(Name));
// Send a message to all players to inform them that this player completed a courier-job
format(Msg, 128, \"{FFFFFF}Pizzafutár {FF00FF}%s{FFFFFF} sikeresen leszálitott {0000FF}%i{FFFFFF} csomagot\", Name, APlayerData[playerid][CourierMaxStep]);
SendClientMessageToAll(0xAA3333AA, Msg);
// Set a payment based on the number of packages
Payment = APlayerData[playerid][CourierMaxStep] * PaymentPerPackage;
// Pay the player money and give scorepoints, both based on the number of packages delivered
RewardPlayer(playerid, Payment, APlayerData[playerid][CourierMaxStep]);
// Send a message to let the player know he finished his mission and got paid
format(Msg, 128, TXT_RewardJob, Payment);
SendClientMessage(playerid, 0xAA3333AA, Msg);
// Increase the stats for completing a courier job
APlayerData[playerid][statsCourierJobs]++;
// End the current trucker job (clear mission-data)
Courier_EndJob(playerid);
// Also save the data (in case the server crashes, progress would be lost)
PlayerFile_Save(playerid);
}
}
else
SendClientMessage(playerid, 0xAA3333AA, TXT_NeedOnFootToProceed);
return 1;
}
// A timer that runs every second to see if the player is still inside his vehicle
public Courier_VehicleTimer(playerid)
{
new OldVehicleID = APlayerData[playerid][VehicleID];
new NewVehicleID = GetPlayerVehicleID(playerid);
if (APlayerData[playerid][VehicleTimerTime] != 0)
{
// If VehicleID and TrailerID are still the same as when the player accepted the job
if (OldVehicleID == NewVehicleID)
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails
else // Player stepped out of his vehicle
{
new TimeLeft[5];
// Reduce the time left by 1
APlayerData[playerid][VehicleTimerTime] = APlayerData[playerid][VehicleTimerTime] - 1;
// Convert the time left to a string for displaying
valstr(TimeLeft, APlayerData[playerid][VehicleTimerTime]);
// Display the time left
GameTextForPlayer(playerid, TimeLeft, 1000, 4);
// Send only one message to inform the player what he must do
if (APlayerData[playerid][VehicleTimerTime] == (Job_TimeToFailMission - 1))
SendClientMessage(playerid, 0xAA3333AA, \"Szálj be egy csomagkihordó jármûbe\");
}
}
else
{
// Time left has reached 0
Courier_EndJob(playerid);
// Inform the player that he failed the mission
GameTextForPlayer(playerid, TXT_FailedMission, 5000, 4);
// Reduce the player\'s cash by 1000
RewardPlayer(playerid, -1000, 0);
}
}
// This function is used to stop any Courier-mission that has been started
Courier_EndJob(playerid)
{
if (APlayerData[playerid][JobStarted] == true)
{
// Clear all data about the job from the player, so he can start a new one
APlayerData[playerid][JobStarted] = false;
APlayerData[playerid][JobStep] = 0;
APlayerData[playerid][VehicleTimerTime] = 0;
APlayerData[playerid][VehicleID] = 0;
APlayerData[playerid][CourierMaxStep] = 0;
// Clear the list of houses-in-range
for (new i; i < 11; i++)
APlayerData[playerid][CourierHouses] = 0;
// Delete the checkpoint
DisablePlayerCheckpoint(playerid);
// Reset the missiontext
TextDrawSetString(APlayerData[playerid][MissionText], \"Vállalj munkát \\\"~g~/munka~w~\\\" parancsal.\");
// Kill the VehicleTimer
KillTimer(APlayerData[playerid][VehicleTimer]);
}
return 1;
}
Rendõrös
// Forward the function to timer to check players every second to see if they\'re wanted
forward Police_CheckWantedPlayers(playerid);
forward UnjailPlayer(playerid);
// This timer is created every time a player changes his class to police
public Police_CheckWantedPlayers(playerid)
{
// Scan through all players
for (new PlayerToCheck; PlayerToCheck < MAX_PLAYERS; PlayerToCheck++)
{
// check if this player is connected
if (IsPlayerConnected(PlayerToCheck))
{
//Check if that player is wanted
if (GetPlayerWantedLevel(PlayerToCheck) > 0)
SetPlayerMarkerForPlayer(playerid, PlayerToCheck, 0xFF0000FF); // Make that player red to the police-player
else
{
// Reset the playercolor based on the player\'s class
switch (APlayerData[PlayerToCheck][PlayerClass])
{
case ClassTruckDriver: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassTruckDriver);
case ClassBusDriver: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassBusDriver);
case ClassPilot: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassPilot);
case ClassPolice: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassPolice);
case ClassMafia: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassMafia);
case ClassCourier: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassCourier);
case ClassAssistance: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassAssistance);
case ClassKukasDriver: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassKukasDriver);
case ClassDumper: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassDumper);
}
}
}
}
}
// This function gets called when a police player presses the SECUNDAIRY FIRE button (to warn nearby wanted players)
Police_WarnNearbyPlayers(playerid)
{
// Setup local variables
new Float:x, Float:y, Float:z, Name[24], Msg[128];
// Scan through all players
for (new PlayerToCheck; PlayerToCheck < MAX_PLAYERS; PlayerToCheck++)
{
// check if this player is connected
if (IsPlayerConnected(PlayerToCheck))
{
// Check if the current player is wanted
if (GetPlayerWantedLevel(PlayerToCheck) > 0)
{
// Get the position of this player
GetPlayerPos(PlayerToCheck, x, y, z);
// Check if the police-player is in range of the player
if (IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z))
{
GameTextForPlayer(PlayerToCheck, \"Hªz¦djon f¾lre!!! Itt a rend§rs¾g!!!\", 3000, 4); // Warn the player
// Also start a timer which gives the player a chance to stop and get a fine
// If he doesn\'t stop, the player will be sent to jail when he gets fined
if (APlayerData[PlayerToCheck][PoliceWarnedMe] == false)
{
APlayerData[PlayerToCheck][PoliceWarnedMe] = true;
APlayerData[PlayerToCheck][Value_PoliceCanJailMe] = 60;
APlayerData[PlayerToCheck][Timer_PoliceCanJailMe] = SetTimerEx(\"Timer_PoliceCanJailPlayer\", 5000, true, \"i\", PlayerToCheck);
}
// Let the police player know that he warned the player
GetPlayerName(PlayerToCheck, Name, sizeof(Name));
format(Msg, 128, \"{00FF00}Felszólítottad {FFFF00}%s\", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
}
}
return 1;
}
// This function gets called when a police player presses the FIRE key (to fine nearby wanted players) when he\'s on foot
Police_FineNearbyPlayers(playerid)
{
// Setup local variables
new Float:x, Float:y, Float:z;
// Scan through all players
for (new PlayerToCheck; PlayerToCheck < MAX_PLAYERS; PlayerToCheck++)
{
// check if this player is connected
if (IsPlayerConnected(PlayerToCheck))
{
// Check if the other player isn\'t the same police player
if (PlayerToCheck != playerid)
{
// Check if the current player is wanted and the wanted player is driving slowly (below 30 kph)
if ((GetPlayerWantedLevel(PlayerToCheck) > 0) && (APlayerData[PlayerToCheck][PlayerSpeed] < 30))
{
// Get the position of this player
GetPlayerPos(PlayerToCheck, x, y, z);
// Check if the police-player is in range of the player (police player and wanted player must be within 10 meters of eachother)
if (IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
// Fine the player
Police_PayFine(playerid, PlayerToCheck);
// Exit the function
return 1;
}
// Check if the police-player is in range of the player (he can be inside his vehicle or on foot)
if (IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z))
{
GameTextForPlayer(PlayerToCheck, \"Hªz¦djon f¾lre!!! Itt a rend§rs¾g!!!\", 3000, 4); // Warn the player
// Also start a timer which gives the player a chance to stop and get a fine
// If he doesn\'t stop, the player will be sent to jail when he gets fined
if (APlayerData[PlayerToCheck][PoliceWarnedMe] == false)
{
APlayerData[PlayerToCheck][PoliceWarnedMe] = true;
APlayerData[PlayerToCheck][Value_PoliceCanJailMe] = DefaultWarnTimeBeforeJail;
APlayerData[PlayerToCheck][Timer_PoliceCanJailMe] = SetTimerEx(\"Timer_PoliceCanJailPlayer\", 5000, true, \"i\", PlayerToCheck);
}
}
}
}
}
}
return 1;
}
// Pay the police player and fine the player
Police_PayFine(playerid, PlayerToFine)
{
// Setup local variables
new PoliceName[24], FinedPlayerName[24], PoliceMsg[200], PlayerMsg[200], JailTime, Fine;
// Get the names of the police player and the wanted player
GetPlayerName(playerid, PoliceName, 24);
GetPlayerName(PlayerToFine, FinedPlayerName, 24);
// Check if the wanted player\'s timer hasn\'t ran out yet
if (APlayerData[PlayerToFine][PoliceCanJailMe] == false)
{
// Calculate the fine
Fine = GetPlayerWantedLevel(PlayerToFine) * DefaultFinePerStar;
// Reward the police player (give cash and points)
RewardPlayer(playerid, Fine, GetPlayerWantedLevel(PlayerToFine));
// Let the police player know that he fined the player
format(PoliceMsg, 200, \"Megbüntette: $%i\", FinedPlayerName, Fine);
SendClientMessage(playerid, 0xFF7318FF, PoliceMsg);
// Let the wanted player pay the fine
RewardPlayer(PlayerToFine, -Fine, 0);
format(PlayerMsg, 200, \"Elkapott %s és enyi birságot fizettél $%i\", PoliceName, Fine);
SendClientMessage(PlayerToFine, 0xFF7318FF, PlayerMsg);
// Let the other players know that the police player has fined the wanted player
format(PoliceMsg, 200, \"%s Megbüntette: %s\", PoliceName, FinedPlayerName);
SendClientMessageToAll(0xFF7318FF, PoliceMsg);
// Increase the stats for fining a player
APlayerData[playerid][statsPoliceFined]++;
}
else // The wanted player didn\'t pull over, now the police player has the right to send him to jail and double the fine
{
// Set jailtime
JailTime = DefaultJailTime;
// Calculate the fine (double the normal fine)
Fine = GetPlayerWantedLevel(PlayerToFine) * DefaultFinePerStar * 2;
// Reward the police player (give cash and points)
RewardPlayer(playerid, Fine, GetPlayerWantedLevel(PlayerToFine));
// Let the police player know that he jailed the wanted player
format(PoliceMsg, 200, \"Lecsukta és szerzett: $%i\", FinedPlayerName, Fine);
SendClientMessage(playerid, 0xFF7318FF, PoliceMsg);
// Let the wanted player pay a double fine
RewardPlayer(PlayerToFine, -Fine, 0);
// Let the player know he\'s been jailed and for how long
format(PlayerMsg, 200, \"Bezártak a börtönbe %s ennyi %i percre, PoliceName\", (JailTime / 75));
SendClientMessage(PlayerToFine, 0xFF7318FF, PlayerMsg);
// Let the other players know that the police player has jailed the wanted player
format(PoliceMsg, 200, \"Rendõr tiszt %s A börtönbe zárta %s a %i perc\", PoliceName, FinedPlayerName, (JailTime / 75));
SendClientMessageToAll(0xFF7318FF, PoliceMsg);
// Teleport the player to jail
Police_JailPlayer(PlayerToFine, JailTime);
// Increase the stats for jailing a player
APlayerData[playerid][statsPoliceJailed]++;
}
// Clear the wanted player\'s wanted status (the speedometer will automatically clear all data and kill the timer)
SetPlayerWantedLevel(PlayerToFine, 0);
// Also save the data (in case the server crashes, progress would be lost)
PlayerFile_Save(playerid);
PlayerFile_Save(PlayerToFine);
return 1;
}
// This function ports the player inside the jail and sets a timer to get him back out
Police_JailPlayer(playerid, JailTime)
{
// First remove the player from his vehicle
RemovePlayerFromVehicle(playerid);
// Set the player in the virtual world of the jail (so other players cannot see the jailed players on their radar)
SetPlayerVirtualWorld(playerid, WORLD_JAIL);
// Set player interior to the police station in San Fierro
SetPlayerInterior(playerid, 10);
// Put the player inside the jail
SetPlayerPos(playerid, 220.0, 110.0, 999.1);
// Store the jailtime for this player
APlayerData[playerid][PlayerJailed] = JailTime;
// Start the jailtimer, which checks every second if the player is allowed to get out
KillTimer(APlayerData[playerid][PlayerJailedTimer]);
APlayerData[playerid][PlayerJailedTimer] = SetTimerEx(\"UnjailPlayer\", 1000, true, \"i\", playerid);
// If the player started a job, let it fail
if (APlayerData[playerid][JobStarted] == true)
{
// Stop any job that may have started
switch (APlayerData[playerid][PlayerClass])
{
case ClassTruckDriver: Trucker_EndJob(playerid);
case ClassBusDriver: BusDriver_EndJob(playerid);
case ClassPilot: Pilot_EndJob(playerid);
case ClassPolice: Police_EndJob(playerid);
case ClassMafia: Mafia_EndJob(playerid);
case ClassCourier: Courier_EndJob(playerid);
case ClassAssistance: Assistance_EndJob(playerid);
case ClassKukasDriver: KukasDriver_EndJob(playerid);
case ClassDumper: Dumper_EndJob(playerid);
}
// Inform the player that he failed the mission
GameTextForPlayer(playerid, \"~w~Te ~r~elrontottad~w~ a munkát.Ezért ~y~$1000~w~ levonunk tõled.\", 5000, 4);
// Reduce the player\'s cash by 1000
RewardPlayer(playerid, -1000, 0);
}
return 1;
}
// This is the timer that runs for every player who\'s in jail
public UnjailPlayer(playerid)
{
new JailMsg[20];
// Check if the player is allowed to leave yet
if (APlayerData[playerid][PlayerJailed] == 0)
{
// Set the player in the normal world
SetPlayerVirtualWorld(playerid, 0);
// Set player interior to the outside
SetPlayerInterior(playerid, 0);
// Put the player outside the jail (he should spawn at the location where he spawned after login or after choosing a rescue-point)
SpawnPlayer(playerid);
// Also, kill the jailtimer
KillTimer(APlayerData[playerid][PlayerJailedTimer]);
}
else
{
// Show the remaining jailtime (only if the remaining time is below 60 seconds)
if (APlayerData[playerid][PlayerJailed] < 60)
{
format(JailMsg, 20, \"~w~Szabadulsz: ~r~%i~w~ másodperc mulva.\", APlayerData[playerid][PlayerJailed]);
GameTextForPlayer(playerid, JailMsg, 750, 4);
}
// Decrease the jailtime by 1 second
APlayerData[playerid][PlayerJailed] = APlayerData[playerid][PlayerJailed] - 1;
}
}
// This function gets called when the police player dies (or changes class)
Police_EndJob(playerid)
{
// Kill the PlayerCheckTimer
KillTimer(APlayerData[playerid][PlayerCheckTimer]);
// Scan through all players (to reset them to their default colors for the police-player)
for (new PlayerToCheck; PlayerToCheck < MAX_PLAYERS; PlayerToCheck++)
{
// check if this player is connected
if (IsPlayerConnected(PlayerToCheck))
{
// Reset the playercolor based on the player\'s class
switch (APlayerData[PlayerToCheck][PlayerClass])
{
case ClassTruckDriver: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassTruckDriver);
case ClassBusDriver: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassBusDriver);
case ClassPilot: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassPilot);
case ClassPolice: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassPolice);
case ClassMafia: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassMafia);
case ClassCourier: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassCourier);
case ClassAssistance: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassAssistance);
case ClassKukasDriver: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassKukasDriver);
case ClassDumper: SetPlayerMarkerForPlayer(playerid, PlayerToCheck, ColorClassDumper);
}
}
}
return 1;
}
// This timer is started when a wanted player was warned by a police player
forward Timer_PoliceCanJailPlayer(playerid);
public Timer_PoliceCanJailPlayer(playerid)
{
// Setup local variables
new Msg[128];
// Let the player know how much time he has left to pull over
format(Msg, 128, \"{FF0000}Álj meg %i másodperced van rá \", APlayerData[playerid][Value_PoliceCanJailMe]);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
// Check if the timer has ran out
if (APlayerData[playerid][Value_PoliceCanJailMe] == 0)
{
// Set a switch that indicates that this player didn\'t stop when he got the warning from the police player
// When the police can catch him now, he\'ll be sent to jail and the fine is doubled
APlayerData[playerid][PoliceCanJailMe] = true;
// Also kill the timer, as it\'s not needed anymore
KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]);
// Let the player know what consequences it will have by not stopping
format(Msg, 128, \"{FF0000}Ha legközelebb meg álsz börtönbe csuknak\");
SendClientMessage(playerid, 0xFF7318FF, Msg);
format(Msg, 128, \"{FF0000}Bírság duplájára növekedett\");
SendClientMessage(playerid, 0xFF7318FF, Msg);
}
// Reduce the remaining time by 5 seconds
APlayerData[playerid][Value_PoliceCanJailMe] = APlayerData[playerid][Value_PoliceCanJailMe] - 5;
return 1;
}
// This function creates a spikestrip when the player is standing
SpikeStrip_Create(playerid)
{
// Setup local variables
new StripIndex = -1, Float:x, Float:y, Float:z, Float:rot;
// Check if a spikestrip can be created
for (new i; i < MAX_SPIKESTRIPS; i++)
{
if (ASpikeStrips[spikeTime] == 0)
{
StripIndex = i;
break;
}
}
// Check if a free index has been found
if (StripIndex != -1)
{
// Get the position of the player
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, rot);
// Create a new spike-strip object at the location of the player and store the coordinates of the spikestrip
ASpikeStrips[stripIndex][spikeObject] = CreateObject(2892, x, y, z - 1.0, 0.0, 0.0, rot + 90.0);
ASpikeStrips[stripIndex][spikeX] = x;
ASpikeStrips[stripIndex][spikeY] = y;
ASpikeStrips[stripIndex][spikeZ] = z;
// Set the time for this timer to 1 minute
ASpikeStrips[stripIndex][spikeTime] = 600;
// Create a timer that checks all players in range to see if they run over the spikestrip
ASpikeStrips[stripIndex][spikeTimer] = SetTimerEx(\"CheckSpikeStrip\", 100, true, \"i\", StripIndex);
// Let the player know he created a spikestrip
SendClientMessage(playerid, 0xFFFFFFFF, \"{00FF00}Letetted a szögesdrótot.\");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Nem tehetsz le több szögesdrótot.\");
}
// This timer checks the spikestrips that have been planted (they automatically disappear after one minute)
forward CheckSpikeStrip(StripIndex);
public CheckSpikeStrip(StripIndex)
{
// Setup local variables
new vid, panels, doors, lights, tires;
// Decrease the time left for the spikestrip
ASpikeStrips[stripIndex][spikeTime]--;
// Check if the spikestrip is still allowed to exist
if (ASpikeStrips[stripIndex][spikeTime] > 0)
{
// Loop through all players
for (new playerid; playerid < MAX_PLAYERS; playerid++)
{
// Check if the player is connected
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player is the driver of a vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Get the vehicleid
vid = GetPlayerVehicleID(playerid);
// Check if the player is near the spikestrip object
if (IsPlayerInRangeOfPoint(playerid, 7.0, ASpikeStrips[stripIndex][spikeX], ASpikeStrips[stripIndex][spikeY], ASpikeStrips[stripIndex][spikeZ]))
{
// Pop all the tires of the player\'s vehicle
GetVehicleDamageStatus(vid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vid, panels, doors, lights, 15);
}
}
}
}
}
else
{
// Kill the timer and destroy the spikestrip object
DestroyObject(ASpikeStrips[stripIndex][spikeObject]);
KillTimer(ASpikeStrips[stripIndex][spikeTimer]);
}
return 1;
}
// This function sends the given message to all police players
Police_SendMessage(PoliceMessage[])
{
for (new PoliceID; PoliceID < MAX_PLAYERS; PoliceID++) // Loop through all players
if (APlayerData[PoliceID][LoggedIn] == true) // Check if this player has logged in
if (APlayerData[PoliceID][PlayerClass] == ClassPolice) // Check if this player is a police player
SendClientMessage(PoliceID, 0xFFFFFFFF, PoliceMessage); // Send the message to the police player
}
Dupla hozzászólás automatikusan összefûzve. ( 2012. június 29. - 21:50:32 )
És még kellene nekem olyan sript hogy ha hirdetnek akkor ki csilagoza a számokat pl:154788 ********