Jump to content
  • 0

Schimbare comanda


Clarisa123

Question

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
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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
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
Answer this question...

×   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.