Please help: Convert FS to GM script
#1

Can someone help me convert this to a GM script? Please and Thanks

Код:
#include a_samp
#define COLOUR_RED 0xFF0000C9
#define COLOR_YELLOW 0xFFFF00FF
//
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define HOLDING(%0) \
	((newkeys & (%0)) == (%0))
//
public OnFilterScriptInit()
{
	print("\n-------------------------------------------------");
	print("Devon's Vehicle Commands initiated.                ");
	print("Edition: STRCMP v1.1 - Release v2.0 - J's version    ");
	print("When requesting support, be sure to include the above line.");
	print("-------------------------------------------------\n");
	return 1;
}
//
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "To exit the vehicle press (F Key) Or (Enter)");
		SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
    }
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/engine", true))
    {
		if(IsPlayerInAnyVehicle(playerid)) {
		    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
				new vehicleid = GetPlayerVehicleID(playerid);
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				if(engine == 1) {
				    SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
				    GameTextForPlayer(playerid, "Engine off.", 200, 1); }
				else {
				    SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
				    GameTextForPlayer(playerid, "Engine on.", 200, 1); }
			}
			else return SendClientMessage(playerid,COLOUR_RED,"You are not the driver of this vehicle!");
		}
		else return SendClientMessage(playerid, COLOUR_RED, "You must be in a vehicle to use this command!");
	}
	return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSED( KEY_JUMP ))
	{
		if(IsPlayerInAnyVehicle(playerid) == 0) return 0;
		else
		{
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
 				new vehicleid = GetPlayerVehicleID(playerid);
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				if(engine == 0) {
			 		SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
			    	GameTextForPlayer(playerid, "Engine on.", 200, 1);
				}
				else return 0;
			}
			else return SendClientMessage(playerid,COLOUR_RED,"You are not the driver of this vehicle!");
		}
	}
	else if(PRESSED( KEY_SECONDARY_ATTACK ))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return 0;
		else RemovePlayerFromVehicle(playerid);
    }
	return 1;
}
stock GetName(playerid)
{
	new name[24];
    if(IsPlayerConnected(playerid)) GetPlayerName(playerid, name, sizeof(name));
	else name = "Unknown";
	return name;
}
Reply
#2

Replace this

OnFilterScriptInit()

to this

OnGameModeInit()

and it will make you a GM with only a /engine
if you meant to place the codes in your gamemode, then press copy and paste xD
Reply
#3

Thanks
Quote:

Replace this

OnFilterScriptInit()

to this

OnGameModeInit()

+1 Rep!
Reply
#4

Wait so shiuld I keep the
Код:
 public OnFilterScriptInit() { print("\n-------------------------------------------------"); print("Devon's Vehicle Commands initiated. "); print("Edition: STRCMP v1.1 - Release v2.0 - J's version "); print("When requesting support, be sure to include the above line."); print("-------------------------------------------------\n"); return 1; } //
part?
Reply
#5

Change the OnFilterScriptInit to OnGameModeInit and yes you should keep them, it's the credits. You can't just remove the credits. It would be unfair for the creator.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)