FS To A GM
#1

how hard would you say it is to implement a FS Into A GM?
Reply
#2

Depends on the lenght. But I made it with a ~50 000 lines script in ~15 mins.
Reply
#3

Like i put the defines and news and everything at the top and then add the script part from the fs into the gm where technicaly i could put it.
Top Of GM (What Im Dealing With Is The Car Turning Signals)
Код:
#define MAX_ZONE_NAME 28
#define MAX_SPAWN_ATTEMPTS 		4 //This is the amount of times sometime can try to spawn before finally getting kicked.
#define txtcost 15
#define PRODUCT_PRICE 10
//================================[Car Turning Signals]=========================================
#define BLINK_RATE  	400 // This is the rate of flash (also rate of timer in milliseconds, same for pflash)
#define PFLASH_RATE     300 // This controls the rate of flash for public vehicle lights, works for all police, fire, ambulance vehicles
#define LIGHT_KEY		KEY_SUBMISSION // Set this to whatever key you want to turn the lights on
#define MAX_PLAYERS 50
//=================================[DEFINES]==============================================
#define COLOR_FACTIONCHAT 0x01FCFFC8
Where the actual script is from the fs implemented into the gm
Код:
	else if(newstate == PLAYER_STATE_ONFOOT)
	{
		KillTimer(BlinkTime[playerid]);
		SetPVarInt(playerid, "CopFlash", 0);
	}
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSED(LIGHT_KEY))
	{
		if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "CopFlash") == 0)
			{
		 		new panels, doors, lights, tires;
		 		new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
				    case 0:{
				        lights = encode_lights(0, 0, 0, 0);
		      			SetPVarInt(playerid, "vMainOn", 1);
					}
					case 1:{
						lights = encode_lights(1, 1, 1, 1);
						SetPVarInt(playerid, "vMainOn", 0);
					}
				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
			}
		}
	}
	if(PRESSED(KEY_CROUCH))
	{
	    if(IsPublicService(GetPlayerVehicleID(playerid)) && GetPlayerVehicleSeat(playerid) == 0)
		{
			switch(GetPVarInt(playerid, "CopFlash"))
			{
				case 0:{
				    KillTimer(BlinkTime[playerid]);
					BlinkTime[playerid] = SetTimerEx("vBlinker", PFLASH_RATE, 1, "i", playerid);
					SetPVarInt(playerid, "CopFlash", 1);
				}
				case 1:{
		   			KillTimer(BlinkTime[playerid]);
   					new panels, doors, lights, tires;
   					new carid = GetPlayerVehicleID(playerid);
					GetVehicleDamageStatus(carid, panels, doors, lights, tires);
					lights = encode_lights(1, 1, 1, 1);
					UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
					SetPVarInt(playerid, "CopFlash", 0);
				}
			}
		}
	}
	if(PRESSED(KEY_LOOK_LEFT))
	{
		if(GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "vBLeft") == 0)
			{
				KillTimer(BlinkTime[playerid]);
				BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid);
	   			SetPVarInt(playerid, "vBLeft", 1);
	   			SetPVarInt(playerid, "vBRight", 0);
			}else{
			    KillTimer(BlinkTime[playerid]);
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
			    switch(GetPVarInt(playerid, "vMainOn")){
			        case 0:{
			        	lights = encode_lights(1, 1, 1, 1);
					}
					case 1:{
	                    lights = encode_lights(0, 0, 0, 0);
					}
				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
			    SetPVarInt(playerid, "vBLeft", 0);
			}
		}
	}
	if(PRESSED(KEY_LOOK_RIGHT))
	{
		if(GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "vBRight") == 0)
			{
				KillTimer(BlinkTime[playerid]);
				BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid);
	   			SetPVarInt(playerid, "vBRight", 1);
	   			SetPVarInt(playerid, "vBLeft", 0);
			}else{
			    KillTimer(BlinkTime[playerid]);
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
			    switch(GetPVarInt(playerid, "vMainOn")){
			        case 0:{
			        	lights = encode_lights(1, 1, 1, 1);
					}
					case 1:{
	                    lights = encode_lights(0, 0, 0, 0);
					}
				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
			    SetPVarInt(playerid, "vBRight", 0);
			}
		}
	}
	return 1;
}

forward vBlinker(playerid);
public vBlinker(playerid)
{
	if(IsPlayerInAnyVehicle(playerid) && GetPVarInt(playerid, "CopFlash") != 1)
	{
	    new Keys, ud, lr, panels, doors, lights, tires;
	    new carid = GetPlayerVehicleID(playerid);
	    GetPlayerKeys(playerid, Keys, ud, lr);
		GetVehicleDamageStatus(carid, panels, doors, lights, tires);

		if(lr > 0)
		{
			if(GetPVarInt(playerid, "vBLeft") == 1)
			{
			    KillTimer(BlinkTime[playerid]);
			    switch(GetPVarInt(playerid, "vMainOn")){
			        case 0:{
			        	lights = encode_lights(1, 1, 1, 1);
					}
					case 1:{
	                    lights = encode_lights(0, 0, 0, 0);
					}
				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
			    SetPVarInt(playerid, "vBLeft", 0);
			    return 1;
			}
		}
		else if(lr < 0)
		{
			if(GetPVarInt(playerid, "vBRight") == 1)
			{
			    KillTimer(BlinkTime[playerid]);
			    switch(GetPVarInt(playerid, "vMainOn")){
			        case 0:{
			        	lights = encode_lights(1, 1, 1, 1);
					}
					case 1:{
	                    lights = encode_lights(0, 0, 0, 0);
					}
				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
			    SetPVarInt(playerid, "vBRight", 0);
			    return 1;
			}
		}

		if(GetPVarInt(playerid, "vBRight") == 1)
		{
			switch(GetPVarInt(playerid, "vMainOn")){
			    case 0:{
	      			switch(GetPVarInt(playerid, "vBlinkOn")){
	      			    case 0:{
			        		lights = encode_lights(1, 1, 0, 0);
	      					SetPVarInt(playerid, "vBlinkOn", 1);
	      			    }
	      			    case 1:{
							lights = encode_lights(1, 1, 1, 1);
							SetPVarInt(playerid, "vBlinkOn", 0);
	      			    }
					}
				}
				case 1:{
      				switch(GetPVarInt(playerid, "vBlinkOn")){
	      			    case 0:{
			        		lights = encode_lights(0, 0, 1, 1);
	      					SetPVarInt(playerid, "vBlinkOn", 1);
	      			    }
	      			    case 1:{
							lights = encode_lights(0, 0, 0, 0);
							SetPVarInt(playerid, "vBlinkOn", 0);
	      			    }
					}
				}
			}
		}

		if(GetPVarInt(playerid, "vBLeft") == 1)
		{
			switch(GetPVarInt(playerid, "vMainOn")){
			    case 0:{
	      			switch(GetPVarInt(playerid, "vBlinkOn")){
	      			    case 0:{
			        		lights = encode_lights(0, 0, 1, 1);
	      					SetPVarInt(playerid, "vBlinkOn", 1);
	      			    }
	      			    case 1:{
							lights = encode_lights(1, 1, 1, 1);
							SetPVarInt(playerid, "vBlinkOn", 0);
	      			    }
					}
				}
				case 1:{
      				switch(GetPVarInt(playerid, "vBlinkOn")){
	      			    case 0:{
			        		lights = encode_lights(1, 1, 0, 0);
	      					SetPVarInt(playerid, "vBlinkOn", 1);
	      			    }
	      			    case 1:{
							lights = encode_lights(0, 0, 0, 0);
							SetPVarInt(playerid, "vBlinkOn", 0);
	      			    }
					}
				}
			}
		}
		UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
	}
	else if(GetPVarInt(playerid, "CopFlash") == 1)
	{
	    new d[4];
	    new carid = GetPlayerVehicleID(playerid);
		GetVehicleDamageStatus(carid, d[0], d[1], d[2], d[3]);

		switch(GetPVarInt(playerid, "vBlinkOn"))
		{
		   case 0:{
				d[2] = encode_lights(1, 1, 0, 0);
				SetPVarInt(playerid, "vBlinkOn", 1);
		   }
		   case 1:{
				d[2] = encode_lights(0, 0, 1, 1);
				SetPVarInt(playerid, "vBlinkOn", 0);
		   }
		}
		UpdateVehicleDamageStatus(carid, d[0], d[1], d[2], d[3]);
		return 1;
	}
	return 1;
}
// Thanks to JernejL (RedShirt)
encode_lights(light1, light2, light3, light4) {

	return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);

}

IsPublicService(carid)
{
    new PS[11] = { 416, 427, 490, 528, 407, 544, 596, 598, 597, 599, 601 };
    for(new i = 0; i < sizeof(PS); i++)
	{
		if(GetVehicleModel(carid) == PS[i]) return 1;
	}
	return 0;
}
	if(strcmp(cmd, "/listenchat", true) == 0 && PlayerInfo[playerid][pAdmin] >= 2)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (!BigEar[playerid])
			{
				BigEar[playerid] = 1;
			}
			else if (BigEar[playerid])
			{
				(BigEar[playerid] = 0);
			}
		}
		return 1;
	}
 	if(strcmp(cmd, "/afactioncolor", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
And my mistakes
Код:
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(97) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(1704) : warning 213: tag mismatch
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4366) : warning 217: loose indentation
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4366) : error 029: invalid expression, assumed zero
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4367) : error 001: expected token: ";", but found "{"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4371) : warning 225: unreachable code
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4371) : error 029: invalid expression, assumed zero
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4371) : error 017: undefined symbol "reason"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4377) : warning 225: unreachable code
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4377) : error 029: invalid expression, assumed zero
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4377) : error 017: undefined symbol "newstate"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4379) : error 017: undefined symbol "newstate"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4383) : error 017: undefined symbol "GetVehicleDamageStatus"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4384) : error 017: undefined symbol "encode_lights"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4385) : error 017: undefined symbol "SetPVarInt"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4386) : error 017: undefined symbol "UpdateVehicleDamageStatus"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4382) : warning 204: symbol is assigned a value that is never used: "carid"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4381) : warning 203: symbol is never used: "tires"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4384) : warning 204: symbol is assigned a value that is never used: "lights"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4381) : warning 203: symbol is never used: "doors"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4381) : warning 203: symbol is never used: "panels"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4381 -- 4388) : error 017: undefined symbol "newstate"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4391) : error 017: undefined symbol "SetPVarInt"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4396) : warning 225: unreachable code
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4396) : error 029: invalid expression, assumed zero
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4396) : error 017: undefined symbol "newkeys"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4398) : error 017: undefined symbol "PRESSED"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4402) : error 017: undefined symbol "GetPVarInt"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4406) : error 017: undefined symbol "GetVehicleDamageStatus"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4407) : error 017: undefined symbol "GetPVarInt"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4410) : error 017: undefined symbol "encode_lights"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4411) : error 017: undefined symbol "SetPVarInt"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4414) : error 017: undefined symbol "encode_lights"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4415) : error 017: undefined symbol "SetPVarInt"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4418) : error 017: undefined symbol "UpdateVehicleDamageStatus"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4405) : warning 204: symbol is assigned a value that is never used: "carid"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4404) : warning 203: symbol is never used: "tires"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4414) : warning 204: symbol is assigned a value that is never used: "lights"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4404) : warning 203: symbol is never used: "doors"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4404) : warning 203: symbol is never used: "panels"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4404 -- 4422) : error 017: undefined symbol "PRESSED"
C:\Users\Robert\Desktop\SA-MP\gamemodes\crp.pwn(4404 -- 4424) : error 017: undefined symbol "IsPublicService"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#4

It depends if you wanna know the meaning of the script, or just Copy'n'Past.

EDIT:
It looks like you forgot all the "new" defines.
Reply
#5

I wanna know what I'm doing. I am still learning i want to know why it is doing what it's doing i am trying to understand what these errors mean.
Reply
#6

Uhm....No idea with all these errors. If you want you can PM me both codes (GM + FS) and mark with "//" the parts which have to go into your GM, then I can do this for you.

PS: I won't steal/giveaway your script, as I have my own server, so no need.
Reply
#7

Quote:
Originally Posted by robert4049
Посмотреть сообщение
I wanna know what I'm doing. I am still learning i want to know why it is doing what it's doing i am trying to understand what these errors mean.
Quote:

undefined symbol "PRESSED"

Try search for "PRESSED" in the FS, and look for what you're missing.
Do it for all the undefined symbol errors.
Reply
#8

okay i found that. That takes that out and for the undefined i am just adding #define (What ever is missing)
and right now i have it down to 17 errors
also whats the differnce between
return 0
and return 1?
Reply
#9

Quote:
Originally Posted by robert4049
Посмотреть сообщение
okay i found that. That takes that out and for the undefined i am just adding #define (What ever is missing)
and right now i have it down to 17 errors
also whats the differnce between
return 0
and return 1?
pawn Код:
return 1;
returns true,
pawn Код:
return 0;
returns false.
Reply
#10

which what do those mean?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)