0% found this document useful (0 votes)
87 views6 pages

SA-MP Job FilterScript Overview

Uploaded by

hakernayan12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views6 pages

SA-MP Job FilterScript Overview

Uploaded by

hakernayan12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/////////Job FilterScript by Rangerxxll///////////

////////Feel free to edit it in any way. I'm not worried about credits, this took
me 10 minutes to make/////////
////////V1.00, I plan on adding more jobs to it. Such as a flying job, pizza boy,
mail man, and all of that.//////
/////// Check my Forums post to stay updated, on [Link]//////////

// Includes.
#include <a_samp>
#include <sscanf2>
#include <zcmd>
//Defining the checkpoints
#define startcp 2460.6772,-2120.8718,13.5530
#define cp1 2376.2813,-1906.0054,13.3828
#define cp2 2445.0811,-1761.3519,13.5865
#define cp3 2475.5999,-1528.2408,24.0023
#define cp4 2421.6868,-1223.6115,25.2789
//color
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_BLUEGREEN 0x46BBAA00
#define COLOR_RED 0xAA3333AA
//variable for checkpoints
new atcp[MAX_PLAYERS];

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Job Filterscript by Rangerxxll(Luke)");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

public OnGameModeInit()
{
CreatePickup(1318,1,2460.6772,-2120.8718,13.5530,0);
Create3DTextLabel("Trucker Job Starting Position. /work to begin.",
COLOR_RED, 2460.6772,-2120.8718,13.5530, 40.0, 0, 0);
AddStaticVehicleEx(498,2484.60009766,-2117.19995117,13.80000019,0.00000000,-
1,-1,15); //Boxville
AddStaticVehicleEx(498,2508.60009766,-2116.19995117,13.80000019,0.00000000,-
1,-1,15); //Boxville
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
// You can easily change the color of the Text Label. Just edit "COLOR_RED" to
whatever suites you best.
//You can also add more vehicles, feel free to map more Boxvilles. (ID 408)

public OnPlayerRequestClass(playerid, classid)


{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)


{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)


{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)


{
return 1;
}

public OnPlayerText(playerid, text[])


{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])


{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)


{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)


{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
if(atcp[playerid] == 1)
{
atcp[playerid] = 2;
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_LIGHTCYAN, "Unloading, please
wait...");
SetTimerEx("cp1unload", 5000, false, "i", playerid);
return 1;
}
if(atcp[playerid] == 2)
{
atcp[playerid] = 3;
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_LIGHTCYAN, "Unloading, please
wait...");
SetTimerEx("cp2unload", 5000, false, "i", playerid);
return 1;
}
if(atcp[playerid] == 3)
{
atcp[playerid] = 4;
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_LIGHTCYAN, "Unloading, please
wait...");
SetTimerEx("cp3unload", 5000, false, "i", playerid);
return 1;
}
if(atcp[playerid] == 4)
{
atcp[playerid] = 0;
SendClientMessage(playerid, COLOR_LIGHTCYAN, "You have earned your
money. Congratulations. +7500$");
GivePlayerMoney(playerid, 7500);
return 1;
}
return 1;
}

forward cp1unload(playerid);
public cp1unload(playerid)
{
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_BLUEGREEN, "Unloading Complete. Proceed to
the next checkpoint.");
SetPlayerCheckpoint(playerid, cp2, 4.0);
return 1;
}

forward cp2unload(playerid);
public cp2unload(playerid)
{
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_BLUEGREEN, "Unloading Complete. Proceed to
the next checkpoint.");
SetPlayerCheckpoint(playerid, cp3, 4.0);
return 1;
}

forward cp3unload(playerid);
public cp3unload(playerid)
{
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_BLUEGREEN, "Unloading Complete. Proceed to
the last checkpoint to retrieve your paycheck.");
SetPlayerCheckpoint(playerid, startcp, 4.0);
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)


{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)


{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)


{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)


{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)


{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)


{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)


{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)


{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)


{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)


{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)


{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)


{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)


{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])


{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)


{
return 1;
}

CMD:work(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, startcp))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
{
if(atcp[playerid] == 0)
{
atcp[playerid] = 1;
SetPlayerCheckpoint(playerid, cp1, 4.0);
SendClientMessage(playerid, COLOR_LIGHTCYAN,
"Congratulations, you have started the job. Proceed to the checkpoints.");
return 1;
}
}
else SendClientMessage(playerid, COLOR_RED, "You're not in a Boxville.
Please pick one up at the Trucker Job.");
}
else SendClientMessage(playerid, COLOR_RED, "You're not near the Truck
Job.");
return 1;
}

CMD:tp(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED,
"Administrators only.");
{
SetPlayerPos(playerid, startcp);
return 1;
}
}

//WILL BE UPDATED FREQUENTLY, STAY UPDATED ON THE FORUMS//

Common questions

Powered by AI

The script employs numerous function hooks such as 'OnPlayerConnect', 'OnPlayerDeath', 'OnVehicleSpawn', and others to handle game state changes and player actions. These hooks allow the script to execute corresponding functions in response to specific events, ensuring real-time updates to the game based on player interactions and game state transitions. This approach modularizes event management, allowing streamlined updates and extension opportunities .

The truck delivery job could be expanded by incorporating multiple destinations, varied delivery routes, and dynamic events or obstacles along the way. Additionally, integrating real-time rewards based on job performance, adding time constraints, or introducing competitive elements between players could heighten engagement. These expansions would leverage existing checkpoints, colors, and vehicle configurations for a richer and more immersive experience .

Defined colors in the script are used for visual communication with players through in-game text messages. Variables like 'COLOR_LIGHTCYAN' and 'COLOR_BLUEGREEN' represent specific colors associated with messages to improve visibility and signify different stages and actions, such as unloading being completed or directing players to the next checkpoint. This use of color enhances user experience by providing prompt recognition and clarity .

The script includes the 'OnPlayerDisconnect' function which is critical for maintaining game stability. This function ensures that specific actions are taken whenever players leave, avoiding potential errors or inconsistencies in the game's state. While the script currently returns a fixed value, it sets a foundation for further extensions, like resource cleanup or updating player data, which are crucial for multiplayer stability and fairness .

The script utilizes a series of functions and variables to manage checkpoint progression. It assigns a status to each player through a variable array 'atcp[MAX_PLAYERS]'. When a player reaches a checkpoint, their status is incremented, and messages are sent to guide them. For example, upon entering a checkpoint (using 'OnPlayerEnterCheckpoint'), the player's status (atcp) is checked, and if it's at step 1, it moves to 2 with a message prompting to unload and a 5-second timer activated (e.g., 'SetTimerEx("cp1unload", 5000, false, "i", playerid)'). This sequence repeats for all defined checkpoints .

The script suggests adding more jobs such as a flying job, pizza boy, and mailman, alluding to enriching the gameplay experience. Incorporating these roles would diversify player engagement, potentially increasing repetitive play and broader interactions. Additionally, altering checkpoint colors and vehicle types are advised, allowing for personalized and visually distinct play environments .

The script utilizes player command text interactions efficiently by employing an 'OnPlayerCommandText' function. This function examines input command text and performs corresponding actions, such as starting a job with '/work'. By checking command validity with 'strcmp', this implementation ensures robustness and clear pathways for action based on player commands. The approach is effective as it integrates seamlessly with pre-defined game mechanics, allowing customization and expansion .

The script defines several checkpoints for the Trucker Job: the starting checkpoint (2460.6772, -2120.8718, 13.5530) and subsequent checkpoints (cp1 through cp4) at specified coordinates like 2376.2813, -1906.0054, 13.3828 for cp1. These checkpoints interact with the player by being set as objectives they must reach sequentially. Upon arrival, the player's status is updated, and messages guide further actions, facilitating job completion .

To begin the 'Trucker Job', the player must be in proximity to the starting checkpoint and in the correct vehicle type. Specifically, the script checks if the player is within a 4.0 unit radius of 'startcp' and confirms that their vehicle model is 498 (Boxville). If both conditions are met, the 'atcp' status is set to 1, and the player is prompted to proceed to the first checkpoint .

The script restricts certain commands to administrators using the function 'IsPlayerAdmin', which checks the player's administrative status before allowing command execution. For example, the '/tp' (teleport) command checks this status, and only administrators can execute it. This restriction is necessary to maintain game integrity, preventing regular players from exploiting elevated privileges which could disrupt balance or fairness .

You might also like