Jump to content

Question

Posted (edited)

Salutare, la pronirea masini trebuie sa scriu /engine, vreau sa modific /engine in apasarea tastei "2"

if(strcmp(cmd, "/engine", true) == 0)

La fel vreau sa fac si cu /enter , sa nu mai scriu /enter doar sa apas tasta F.

La fel si cu /lights , vreau sa se aprinda farurile pe tasta CTRL.

Cum ar trebui sa modific linia?

Multumesc frumos !

Edited by Clarisa123

1 answer to this question

Recommended Posts

  • 0
Posted

Buna ziua,

Chestia asta se face la:

OnPlayerKeyStateChange

Definesti ceva de genul:

#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

Apoi la OnPlayerKeyStateChange pui ceva de genul:

	if(PRESSED(KEY_SUBMISSION))
	{
	    new engine, lights, alarm, doors, bonnet, boot, objective;
		if(IsPlayerInAnyVehicle(playerid))
		{
		    new veh = GetPlayerVehicleID(playerid);
	 		if(veh != INVALID_VEHICLE_ID)
			{
				if(EngineStatus[veh] == 0 && (GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
				{
					GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective);
					SetVehicleParamsEx(veh, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
					EngineStatus[veh] = 1;
					SendClientMessage(playerid, COLOR_GREY, "* You started the Engine.");
				}
				else if(EngineStatus[veh] == 1 && (GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
				{
					GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective);
					SetVehicleParamsEx(veh, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
					EngineStatus[veh] = 0;
					SendClientMessage(playerid, COLOR_GREY, "You stopped the Engine.");
				}
			}
		}
	}

Si cam asta a fost pentru a porni motorul pe tasta 2.

P.S: Asta e doar un exemplu, iti definesti tu cum vrei STRING-uri s.a.m.d.

P.P.S: Tot ceva de genul este si la lumini.

Spor iti doresc.

Cu stima si respect,

FratziWear

Moderator Scripting @SA-MP.ro

  • Upvote 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.