Jump to content

Comenzi(Made By ArchLord)


ArchLord

Recommended Posts

Salutare SAMP Romania.Sunt fondatorul serverului Romania Trucking,server de SAMP ce ruleaza pe gamemode PPC_Trucking,bineinteles,cu majore modificari care ne-au permis sa-i schimbam numele din PPC_Trucking in RO_Trucking(ne-am permis,este si normal,la cat am lucrat) la el.

 

Vreau sa va ajut,si sa va arat unele din comenzile facute de mine(facute si testate pe server propriu),pe care sa le folositi si voi asa cum doriti,pe langa comenzi o sa va arat si cateva din sistemele implementate de mine in gamemode.

 

Si sa incepem!

 

Din cate stiti,comanda /assist arata,in mod normal asa:

// This command allows the player to call for assistance
COMMAND:assist(playerid, params[])
{
	// Setup local variables
	new bool:AssistOnline = false, Msg[128], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/assist", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Get the player's name
		GetPlayerName(playerid, Name, sizeof(Name));
		// Preset the message that needs to be sent to assistance players
		format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} needs assistance, go help him", Name);

		// Check if there is at least one assistance player online
		for (new i; i < MAX_PLAYERS; i++)
		{
			// Check if this player is connected
			if (IsPlayerConnected(i))
			{
				// Check if this player is assistance class
				if (APlayerData[i][PlayerClass] == ClassAssistance)
				{
					// Set the flag to indicate that at least one assistance player is online
				    AssistOnline = true;
				    // Send the assistance player a message to inform him who needs assistance
				    SendClientMessage(i, 0xFFFFFFFF, Msg);
				}
			}
		}

		// Check if there is at least one assistance player online
		if (AssistOnline == true)
		{
			// Set yourself as "AssistanceNeeded"
			APlayerData[playerid][AssistanceNeeded] = true;
			// Let the player know he called for assistance
			SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You've called for assistance");
		}
		else // No assistance is online
		{
			// Check if the player is the driver of a vehicle
			if (GetPlayerVehicleSeat(playerid) == 0)
			{
				// Fully repair the vehicle (damage value and bodywork)
				RepairVehicle(GetPlayerVehicleID(playerid));
				// Also re-fuel the vehicle
				AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
				// Let the player pay for the repairs and refuel (default $2000)
				RewardPlayer(playerid, -2000, 0);
				// Let the player know he spent $2000 for auto-repair because there were no assistance players online
			    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Your vehicle has been auto-repaired and refuelled for $2000");
			    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}because there is no assistance player online");
			}
		}
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}

Asa arata si pe Romania Trucking,pana ne-am gandit sa ne dam putin silinta,iar acum arata asa:

// This command allows the player to call for assistance
COMMAND:assist(playerid, params[])
{
	// Setup local variables
	new bool:AssistOnline = false, Msg[128], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/assist", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Get the player's name
		GetPlayerName(playerid, Name, sizeof(Name));
		// Preset the message that needs to be sent to assistance players
		format(Msg, 128, "{00FF00}Jucatorul{FFFF00}%s{00FF00} are probleme cu vehiculul,du-te si ajuta-l !", Name);

		// Check if there is at least one assistance player online
		for (new i; i < MAX_PLAYERS; i++)
		{
			// Check if this player is connected
			if (IsPlayerConnected(i))
			{
				// Check if this player is assistance class
				if (APlayerData[i][PlayerClass] == ClassAssistance)
				{
					// Set the flag to indicate that at least one assistance player is online
				    AssistOnline = true;
				    // Send the assistance player a message to inform him who needs assistance
				    SendClientMessage(i, 0xFFFFFFFF, Msg);
				}
			}
		}

		// Check if there is at least one assistance player online
		if (AssistOnline == true)
		{
			// Set yourself as "AssistanceNeeded"
			APlayerData[playerid][AssistanceNeeded] = true;
			// Let the player know he called for assistance
			SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Ati sunat la asistenta rutiera,va rugam asteptati!");
		}
		else // No assistance is online
		{
			// Check if the player is the driver of a vehicle
			if (GetPlayerVehicleSeat(playerid) == 0)
			{
				TogglePlayerControllable(playerid, 0);
				// Let the player know about it
				SendClientMessage(playerid, 0x00FF00FF, "Asistenta rutiera va venii in 15 secunde,asteapta!!!");
				SetTimerEx("Asistenta", 15000, false, "i", playerid);
			}
			else
				SendClientMessage(playerid, 0x00FF00FF, "Nu esti conducatorul acestui vehicul!");
		}
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}

// This timer informs the player how long he will be frozen
forward Asistenta(playerid);
public Asistenta(playerid)
{
	new Float:health, Float:trailerhealth;
	GetVehicleHealth(GetPlayerVehicleID(playerid), health);
	GetVehicleHealth(GetVehicleTrailer(GetPlayerVehicleID(playerid)), trailerhealth);

    TogglePlayerControllable(playerid, 1);
    
    if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
	{
	    if(trailerhealth < 1000)
		{
	    	RepairVehicle(GetVehicleTrailer(GetPlayerVehicleID(playerid)));
			RewardPlayer(playerid, -500, 0, 0, 0, 0);
			SendClientMessage(playerid, 0x00FF00FF, "Asistenta rutiera ti-a reparat remorca si ai platit 500$");
		}
		else
		    SendClientMessage(playerid, 0x00FF00FF, "Remorca nu are nevoie de reparatii!");
	}
	
	if(health < 1000)
	{
	    if (AVehicleData[GetPlayerVehicleID(playerid)][Fuel] < MaxFuel)
	    {
			RepairVehicle(GetPlayerVehicleID(playerid));
			RewardPlayer(playerid, -500, 0, 0, 0, 0);
			SendClientMessage(playerid, 0x00FF00FF, "Asistenta rutiera ti-a reparat masina si ai platit 500$");
			AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
			RewardPlayer(playerid, -500, 0, 0, 0, 0);
			SendClientMessage(playerid, 0x00FF00FF, "Asistenta tehnica ti-a reumplut rezervorul pentru 500$");
		}
		else
		    SendClientMessage(playerid, 0x00FF00FF, "Rezervorul tau este plin!");
	}
	else
	    SendClientMessage(playerid, 0x00FF00FF, "Masina nu are nevoie de reparatii!");

	return 1;
}

Nu am modificat mare lucru la ea,ba dimpotriva,am adaugat cat mai mult la ea.I-am adaugat un timer(acel SetTimerEx,merge pe un singur player),odata activata comanda /assist,vei fi inghetat timp de 15 secunde,dupa 15 secunde vei fi dezghetat si daca vehiculul tau are nevoie de combustibil si reparatii,acestea se vor face,daca nu,acestea nu se vor face.De asemenea,am adaugat si reparatia remorcii,este cam greu sa stii cata "viata" mai are remorca ta,asa ca aceasta comanda te anunta atunci cand folosesti /assist daca remorca ta are nevoie sau nu de reparatii.Daca are nevoie,vei plati pe langa taxa de 1.000$(reumplere rezervor+reparatii vehicul) si 500$ pentru reparatia remorcii.

 

Dupa aceasta comanda /assist mi-am luat exemplu si pentru /fine.Comanda /fine arata asa:

// This command allows the player to call for police
COMMAND:fine(playerid, params[])
{
	// Setup local variables
	new bool:CopOnline = false, Msg[128], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/fine", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Get the player's name
		GetPlayerName(playerid, Name, sizeof(Name));
		// Preset the message that needs to be sent to police players
		format(Msg, 128, "{00FF00}Jucatorul{FFFF00}%s{00FF00} vrea sa fie amendat !", Name);

		// Check if there is at least one police player online
		for (new i; i < MAX_PLAYERS; i++)
		{
			// Check if this player is connected
			if (IsPlayerConnected(i))
			{
				// Check if this player is police class
				if (APlayerData[i][PlayerClass] == ClassPolice)
				{
					// Set the flag to indicate that at least one assistance player is online
				    CopOnline = true;
				    // Send the assistance player a message to inform him who needs assistance
				    SendClientMessage(i, 0xFFFFFFFF, Msg);
				}
			}
		}

		// Check if there is at least one police player online
		if (CopOnline == true)
		{
			SendClientMessage(playerid, 0xFFFFFFFF, "{FFFFFF}{00FFFF}{FFFFFF} {a9c4e4}Asteapta ca un politist sa ajunga la tine !");
		}
		else // No police is online
		{
			// Check if the player has wanted
			if (GetPlayerWantedLevel(playerid) > 0)
			{
				TogglePlayerControllable(playerid, 0);
				// Let the player know about it
				SendClientMessage(playerid, 0x00FF00FF, "Politia va ajunge in 15 secunde,asteapta!!!");
				SetTimerEx("Politia", 15000, false, "i", playerid);
			}
			else
				SendClientMessage(playerid, 0x00FF00FF, "Nu ai wanted!");
		}
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}

// This timer informs the player how long he will be frozen
forward Politia(playerid);
public Politia(playerid)
{
	new Fine;
	
	Fine = GetPlayerWantedLevel(playerid) * DefaultFinePerStar;
	RewardPlayer(playerid, -Fine, 0, 0, 0, 0);
	SetPlayerWantedLevel(playerid, 0);
    SendClientMessage(playerid, 0x00FF00FF, "Ai platit amenda!!!");
	TogglePlayerControllable(playerid, 1);

	return 1;
}

Sper sa va bucurati de aceste comenzi la fel de mult cum ma bucur si eu.Cat de curand,tot in acest topic,o sa va arat un sistem de payday implementat in gamemode-ul nostru,si modificat in asa fel incat sa ofere o data la 24 de minute(folosim ceas ca in San Andreas,24 minute=24 ore, un minut=o ora) o suma random de bani si scor,sumele maxime au fost setate la 50.000.000(bani) si 50(scor).

 

Daca am postat gresit acest topic,imi cer scuze,nu am gasit alta locatie pentru el.Probabil ce am facut eu nu este atat de original pe cat as crede,dar cel putin ma simt mandru ca am putut ajuta si alti fondatori de servere,nu neaparat trucking,cu aceste comenzi,si cu urmatoarele  implementari/comenzi.

 

O seara placuta!

 

Cu respect,

ArchLord(Fondator Romania Trucking)

Link to comment
Share on other sites

Noi comenzi!

 

De data aceasta,pentru un radar pe care-l puteti activa din masina.Comanda facuta special pentru serverele ce ruleaza cu gamemode PPC_Trucking sau asemanator acestuia,nu garantez pentru celelalte servere care ruleaza pe gamemode diferit de PPC_Trucking(stunt,RPG,etc.)

 

Comanda este /radar, si arata cam asa:

// Creates a spikestrip (can only be used by police players)
COMMAND:radar(playerid, params[])
{
	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/radar", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player if a police player
		if (APlayerData[playerid][PlayerClass] == ClassPolice)
		{
		    if(GetPVarInt(playerid,"radar") == 0)
		    {
				new vehid = GetPlayerVehicleID (playerid);
		    	if (VehRadarID [vehid] > -1) return 1;

            	new Float: x, Float: y, Float: z, Float: a;
		    	GetVehiclePos (vehid, x, y, z);
		    	GetVehicleZAngle (vehid, a);
		    	SendClientMessage (playerid, COLOR_YELLOW, "Radar has been added successfully.");
		    	VehRadarID [vehid] = CreateObject (367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 300.0);
		    	AttachObjectToVehicle (VehRadarID [vehid], vehid, 0.2, 0.50, 0.3, 0.0, 0.0, 90.0);
		    	if (VehRadarID [vehid] == -1) return 1;
	        	CheckingSpeed [vehid] = SetTimerEx ("UpdateSpeed", 100, 1, "d", vehid);
	        	SetPVarInt(playerid,"radar",1);

		    	for (new i = 0; i < MAX_PLAYERS; i++)
		    	{
      				if (IsPlayerInVehicle (i, vehid))
			        {
          				TextDrawShowForPlayer (i, RadarHud);
					}
		    	}
            }
			else if(GetPVarInt(playerid,"radar") == 1)
			{
				new vehid = GetPlayerVehicleID (playerid);
	        	if (VehRadarID [vehid] == -1) return 1;

		    	DestroyObject (VehRadarID [vehid]);
	        	SendClientMessage (playerid, COLOR_YELLOW, "Radar has been removed successfully.");
	        	VehRadarID [vehid] = -1;
	        	KillTimer (CheckingSpeed [vehid]);
         		CheckingSpeed [vehid] = -1;
         		SetPVarInt(playerid,"radar",0);

	        	for (new i = 0; i < MAX_PLAYERS; i++)
		    	{
		        	if (IsPlayerInVehicle (i, vehid))
		        	{
						TextDrawHideForPlayer (i, RadarHud);
						TextDrawHideForPlayer (playerid, SpeedAndModel [vehid]);
		        	}
		    	}
		    	if (CheckingSpeed [vehid] > 0)
	    	    {
	            	KillTimer (CheckingSpeed [vehid]);
	            	CheckingSpeed [vehid] = -1;
	        	}
	       	 	for (new i = 0; i < MAX_PLAYERS; i++)
				{
					if (IsPlayerInVehicle (i, vehid))
	    			{
		    			TextDrawHideForPlayer (i, SpeedAndModel [vehid]);
 					}
				}
			}
		}
		else
			SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Nu esti politist");
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}

Pentru a o face sa functioneze,urmati urmatorii pasi:

1.In primele randuri din gamemode adaugati urmatorul:

new sVehicleModel[212][] ={
"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial","Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana",
"Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance","Leviathan", "Moonbeam", "Esperanto", "Taxi",
"Washington", "Bobcat","Whoopee", "BF Injection", "Hunter", "Premier","Enforcer", "Securicar", "Banshee",
"Predator", "Bus", "Rhino", "Barracks", "Hotknife","Trailer 1", "Previon", "Coach", "Cabbie", "Stallion",
"Rumpo", "RC Bandit", "Romero", "Packer","Monster", "Admiral", "Squalo","Seasparrow", "Pizzaboy", "Tram", "Trailer 2",
"Turismo", "Speeder", "Reefer", "Tropic","Flatbed", "Yankee", "Caddy", "Solair","Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio",
"Freeway", "RC Baron", "RC Raider","Glendale", "Oceanic", "Sanchez", "Sparrow","Patriot", "Quad", "Coastguard", "Dinghy", "Hermes",
"Sabre", "Rustler", "ZR-350","Walton", "Regina", "Comet", "BMX", "Burrito","Camper", "Marquis", "Baggage", "Dozer", "Maverick",
"News Chopper", "Rancher","FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring","Sandking", "Blista Compact", "Police Maverick",
"Boxvillde", "Benson","Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B","Bloodring Banger", "Rancher", "Super GT", "Elegant",
"Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster","Stunt",  "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer",
"Shamal", "Hydra","FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune","Cadrona", "FBI Truck", "Willard",
"Forklift", "Tractor", "Combine","Feltzer", "Remington", "Slamvan", "Blade", "Freight","Streak","Vortex", "Vincent", "Bullet",
"Clover", "Sadler", "Firetruck LA","Hustler", "Intruder", "Primo", "Cargobob", "Tampa","Sunrise", "Merit","Utility", "Nevada",
"Yosemite", "Windsor", "Monster A", "Monster B", "Uranus", "Jester", "Sultan","Stratum", "Elegy", "Raindance","RC Tiger",
"Flash", "Tahoma", "Savanna", "Bandito","Freight Flat", "Streak Carriage", "Kart","Mower", "Dune", "Sweeper", "Broadway",
"Tornado", "AT-400", "DFT-30", "Huntley", "Stafford","BF-400", "News Van", "Tug", "Trailer 3", "Emperor","Wayfarer", "Euros",
"Hotdog","Club", "Freight Carriage", "Trailer 4","Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)","Police Car (SFPD)",
"Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T", "Alpha","Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
"Luggage Trailer B", "Stairs", "Boxville", "Tiller", "Utility Trailer" };

Info:Aceasta lista va va ajuta sa stiti ce masina urmariti(comanda este facuta special pt politisti).De asemenea,din aceasta comanda puteti face si o noua linie la vitezometru,linie pe care o puteti denumii cum doriti,si o sa va arate ce vehicul conduceti.

2.Cautati #define MAX_PLAYERS si adaugati dupa acesta urmatoarele:

new VehRadarID[MAX_VEHICLES], Text:RadarHud, Text:SpeedAndModel[MAX_VEHICLES], CheckingSpeed[MAX_VEHICLES], OldVehID [MAX_PLAYERS];

3.Mergeti in josul gamemode-ului(de preferat ultimele randuri) si inserati urmatoarele:

forward UpdateSpeed (vehid);
forward CheckValidTextDraws();

public UpdateSpeed (vehid)
{
    new id = GetVehicleInfrontID (vehid);
	if (id < 0)
	{
   		TextDrawSetString (SpeedAndModel [vehid], "~b~N/A ~n~~r~N/A");
	}
	else
	{
		new str[32], Float: velocityX, Float: velocityY, Float: velocityZ;
	   	GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
       	new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 136.666667, floatround_round);
		format (str, sizeof (str), "~b~%s ~n~~r~%d", sVehicleModel [GetVehicleModel (id) - 400], speed);
		TextDrawSetString (SpeedAndModel [vehid], str);
	}

 	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if (IsPlayerInVehicle (i, vehid))
	    {
		    TextDrawShowForPlayer (i, SpeedAndModel [vehid]);
 		}
	}
	return 1;
}

public CheckValidTextDraws()
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
	    if (IsPlayerConnected (i))
	    {
			if (IsPlayerInAnyVehicle (i))
			{
			    new vehid = GetPlayerVehicleID (i);
			    if (VehRadarID [vehid] > -1)
			    {
			        TextDrawShowForPlayer (i, RadarHud);
			        if (CheckingSpeed [vehid] > 0)
			        {
			            TextDrawShowForPlayer (i, SpeedAndModel [vehid]);
			        }
			        else
			        {
			            TextDrawHideForPlayer (i, SpeedAndModel [vehid]);
			        }
			    }
			    else
			    {
			        TextDrawHideForPlayer (i, RadarHud);
			    }
			}

			else
			{
			    TextDrawHideForPlayer (i, RadarHud);
			    TextDrawHideForPlayer (i, SpeedAndModel [OldVehID[i]]);
			    OldVehID [i] = 0;
			}
	    }
	}
	return 1;
}

Info:Fara aceste coduri nu veti putea stii viteza de deplasare a masinii pe care o urmariti.NU SE POATE FOLOSII CA VITEZA PENTRU PROPRIA MASINA!

4.Reveniti la primele randuri din gamemode si adaugati,dupa "stock StripNewLine",urmatoarele:

GetVehicleInfrontID (vehid)
{
    new Float: temp = 7.0;
	new j = 0;
	for (new i = 1; i <= MAX_VEHICLES; i++)
	{
	    new Float: a, Float: x1, Float: y1, Float: z1, Float: x2, Float: y2, Float: z2;
    	GetVehiclePos (vehid, x1, y1, z1);
    	GetVehicleZAngle (vehid, a);
 		if (i != vehid)
 		{
	 		if (GetVehiclePos (i, x2, y2, z2))
			{
				new Float: distance = floatsqroot (floatpower ((x1 - x2), 2) + floatpower ((y1 - y2), 2) + floatpower ((z1 - z2), 2));
				GetVehicleZAngle (vehid, a);

				if (distance < 300.0)
				{
    				x1 = x1 + (distance * floatsin(-a, degrees));
					y1 = y1 + (distance * floatcos(-a, degrees));

					distance = floatsqroot ((floatpower ((x1 - x2), 2)) + (floatpower ((y1 - y2), 2)));

					if (temp > distance)
					{
						temp = distance;
						j = i;
					}
				}
			}
		}
	}
	if (temp < 7.0) return j;
	return -1;
}

 

Daca urmati pasii,comanda trebuie sa mearga 100%,testata pe server propriu(server de trucking,nu garantez pentru alte tipuri de server).

 

Comanda nu este facuta in totalitate de mine,imi asum doar unele modificari aduse ei,printre modificari ma refer la urcarea ei in gamemode(pentru a economisii spatiul consumat de un filterscript) si la editarea ei in asa fel incat sa functioneze la parametrii optimi.

 

In curand am sa va prezint si un model de payday,pe care-l puteti adauga foarte usor in gamemode,fara a avea nevoie de un filterscript.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.