what i am i doing wrong?


					if ( ValidEntity(owner) ) then
					if ply:InVehicle()
					return false
					else
						owner = "Sold"
					else
						owner = "For Sale";
						name = "Press F2";
					end;
				end;
				end;

**
WW2RPScript/gamemode/cl_init.lua:270: ‘then’ expected near ‘return’
**

[lua]if ( ValidEntity(owner) ) then
if ply:InVehicle() then
return false
else
owner = “Sold”
else
owner = “For Sale”;
name = “Press F2”;
end;
end;[/lua]

doesnt work.

[editline]01:44PM[/editline]

WW2RPScript/gamemode/cl_init.lua:273: ‘end’ expected (to close ‘if’ at line 269) near ‘else’

[lua]
if ( ValidEntity(owner) ) then
if ply:InVehicle() then
return false
else
owner = “Sold”
else
owner = “For Sale”;
name = “Press F2”;
end;
end;
end;

[/lua]

[lua]if ( ValidEntity(owner) ) then
if ply:InVehicle() then
return false
else
owner = “Sold”
else – Thisone shouldn’t be here
owner = “For Sale”;
name = “Press F2”;
end;
end; [/lua]

If something then do something elseif something then do something else do something end

You have two cases of else after one if.

none of them did work

Replace the first “else” with “end”.

Hey. Here you go: http://wiki.garrysmod.com/?title=Lua_Tutorial_Series

Learn Lua and fix it yourself.

thanks

[editline]02:56PM[/editline]

they did not work

**
ERROR: GAMEMODE:‘HUDPaint’ Failed: WW2RPScript/gamemode/cl_init.lua:269: attempt to index local ‘ply’ (a nil value)
**

post the function that line 269 is in.

if ply:InVehicle() then

In wich function is this in?

ply is nil. Can’t you read?

function GM:HUDDrawTargetID(ply, vehicle, pl, player)

[editline]03:15PM[/editline]


function GM:HUDDrawTargetID(ply, vehicle, pl, player)
	if ( LocalPlayer():Alive() and !LocalPlayer():GetNetworkedBool("cider_KnockedOut") ) then
		local trace = LocalPlayer():GetEyeTrace();
		
		-- Set the distance that text will be completely faded to the same as the talk radius.
		local fadeDistance = cider.configuration["Talk Radius"];
		
		-- Check if we hit a valid entity.
		if ( ValidEntity(trace.Entity) ) then
			local class = trace.Entity:GetClass();
			
			-- Check if the entity is a player.
			if ( trace.Entity:IsPlayer() ) then
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x and y position.
				local x, y = self:GetScreenCenterBounce();
				
				-- Draw the player's name.
				y = self:DrawInformation(trace.Entity:Name(), "ChatFont", x, y, team.GetColor( trace.Entity:Team() ), alpha);
				
				-- Check if the player is in a clan.
				if (trace.Entity:GetNetworkedString("cider_Clan") != "") then
					y = self:DrawInformation("Clan: "..trace.Entity:GetNetworkedString("cider_Clan"), "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
				end;
				
				-- Draw the player's job.
				y = self:DrawInformation("Job: "..trace.Entity:GetNetworkedString("cider_Job"), "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			elseif ( ValidEntity( trace.Entity:GetNetworkedEntity("cider_Player") ) ) then
				local player = trace.Entity:GetNetworkedEntity("cider_Player");
				
				-- Check if the player is alive.
				if ( player:Alive() and player != LocalPlayer() ) then
					local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
					
					-- Get the x and y position.
					local x, y = self:GetScreenCenterBounce();
					
					-- Draw the player's name.
					y = self:DrawInformation(player:Name(), "ChatFont", x, y, team.GetColor( player:Team() ), alpha);
					
					-- Check if the player is in a clan.
					if (player:GetNetworkedString("cider_Clan") != "") then
						y = self:DrawInformation("Clan: "..player:GetNetworkedString("cider_Clan"), "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
					end;
					
					-- Draw the player's job.
					y = self:DrawInformation("Job: "..player:GetNetworkedString("cider_Job"), "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
				end;
			elseif (class == "cider_item") then
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x and y position.
				local x, y = self:GetScreenCenterBounce();
				
				-- Draw the information and get the new y position.
				y = GAMEMODE:DrawInformation(trace.Entity:GetNetworkedString("cider_Name"), "ChatFont", x, y, Color(255, 125, 0, 255), alpha);
				y = GAMEMODE:DrawInformation("Size: "..trace.Entity:GetNetworkedInt("cider_Size"), "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			elseif ( cider.configuration["Contraband"][class] ) then
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x position, y position and contraband table.
				local x, y = self:GetScreenCenterBounce();
				local contraband = cider.configuration["Contraband"][class];
				
				-- Draw the information and get the new y position.
				y = GAMEMODE:DrawInformation(contraband.name, "ChatFont", x, y, Color(125, 255, 50, 255), alpha);
				y = GAMEMODE:DrawInformation("Energy: "..trace.Entity:GetNetworkedInt("cider_Energy").."/"..contraband.energy, "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			elseif ( cider.entity.isDoor(trace.Entity) ) then
				local unownable = trace.Entity:GetNetworkedBool("cider_Unownable");
				local owner = trace.Entity:GetNetworkedEntity("cider_Owner");
				local name = trace.Entity:GetNetworkedString("cider_Name");
				
				-- Check if the door is unownable.
				if (unownable or trace.Entity.unownable) then
					owner = "Unownable";
					
					-- Check to see if the name is an empty string.
					if (name == "") then name = trace.Entity.name or ""; end; 
				else
 if ( ValidEntity(owner) ) then  
    if ply:InVehicle() then  
        return false  
    end  
         owner = "Sold"  
     else  
         owner = "For Sale";  
        name = "Press F2";  
    end;  

 end;

				
				-- Calculate the alpha from the distance.
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x and y position.
				local x, y = self:GetScreenCenterBounce();
				
				-- Draw the information and get the new y position.
				y = GAMEMODE:DrawInformation(owner, "ChatFont", x, y, Color(125, 50, 255, 255), alpha);
				y = GAMEMODE:DrawInformation(name, "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			elseif ( string.lower( class ) == "cider_money" ) then
				local amount = trace.Entity:GetNetworkedInt("cider_Amount");
				
				-- Calculate the alpha from the distance.
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x and y position.
				local x, y = self:GetScreenCenterBounce();
				
				-- Draw the information and get the new y position.
				y = GAMEMODE:DrawInformation("Money", "ChatFont", x, y, Color(75, 150, 255, 255), alpha);
				y = GAMEMODE:DrawInformation("$"..amount, "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			elseif ( class == "cider_breach" ) then
				local health = trace.Entity:GetNetworkedInt("cider_Health");
				
				-- Calculate the alpha from the distance.
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x and y position.
				local x, y = self:GetScreenCenterBounce();
				
				-- Draw the information and get the new y position.
				y = GAMEMODE:DrawInformation("Breach", "ChatFont", x, y, Color(75, 150, 255, 255), alpha);
				y = GAMEMODE:DrawInformation("Health: "..health.."/100", "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			elseif ( class == "cider_note" ) then
				local text = "";
				
				-- Loop through 1 to 10.
				for i = 1, 10 do
					local line = trace.Entity:GetNetworkedString("cider_Text_"..i);
					
					-- Check if this line exists.
					if (line != "") then
						line = string.Replace(line, " ' ", "'");
						line = string.Replace(line, " : ", ":");
						
						-- Add the line to our text.
						text = text..line;
					end;
				end;
				
				-- Create a table to store the wrapped text and then get the wrapped text.
				local wrapped = {};
				
				-- Wrap the text into our table.
				cider.chatBox.wrapText(text, "ChatFont", 256, nil, wrapped);
				
				-- Calculate the alpha from the distance.
				local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
				
				-- Get the x and y position.
				local x, y = self:GetScreenCenterBounce();
				
				-- Draw the information and get the new y position.
				y = GAMEMODE:DrawInformation("Note", "ChatFont", x, y, Color(75, 150, 255, 255), alpha);
				
				-- Loop through our text.
				for k, v in pairs(wrapped) do
					y = GAMEMODE:DrawInformation(v, "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
				end;
			end;
		end;
	end;
end;

no1 knows?

Read this http://www.lua.org/pil/
then this http://wiki.garrysmod.com/?title=Lua_Tutorial_Series

Then ask for help

Of course it’s a cider remake.

Here’s what you want to do:

Go to gamemode/core/libaries/sh_entity.lua and replace the isDoor function with this:
[lua]-- Check if an entity is a door.
function cider.entity.isDoor(entity)
local class = entity:GetClass();

-- Check if the entity is a valid door class.
if (class == "func_door" or class == "func_door_rotating" or class == "prop_door_rotating" or class == "prop_vehicle_jeep") then
	return true;
else
	return false;
end;

end;[/lua]

Next, go to cl_init.lua and scroll down to the function GM:HUDDrawTargetID(), look for this line:
[lua] elseif ( cider.entity.isDoor(trace.Entity) ) then[/lua]

Replace it’s whole block(Everything that follows until: elseif ( string.lower( class ) == “cider_money” ) then with this:

[lua]
local unownable = trace.Entity:GetNetworkedBool(“cider_Unownable”);
local owner = trace.Entity:GetNetworkedEntity(“cider_Owner”);
local name = trace.Entity:GetNetworkedString(“cider_Name”);

			-- Check if the door is unownable.
			if (unownable or trace.Entity.unownable) then
				owner = "Unownable";
				
				-- Check to see if the name is an empty string.
				if (name == "") then name = trace.Entity.name or ""; end;
			else
				if ( ValidEntity(owner) ) then
					if ( trace.Entity:GetClass() == "prop_vehicle_jeep" ) then
						owner = "A Vehicle"
						for k, v in pairs (cider.item.stored) do
							if( trace.Entity:GetModel() == v.model ) then
								if( trace.Entity:GetSkin() == v.skin ) then
									owner = v.detail
								end
							end
						end
					else
						owner = "Sold"
					end
				else
					owner = "For Sale";
					name = "Press F2";
				end;
			end;
			
			-- Calculate the alpha from the distance.
			local alpha = math.Clamp(255 - ( (255 / fadeDistance) * ( LocalPlayer():GetPos():Distance( trace.Entity:GetPos() ) ) ), 0, 255);
			
			-- Get the x and y position.
			local x, y = self:GetScreenCenterBounce();
			
			-- Draw the information and get the new y position.
			y = GAMEMODE:DrawInformation(owner, "ChatFont", x, y, Color(125, 50, 255, 255), alpha);
			y = GAMEMODE:DrawInformation(name, "ChatFont", x, y, Color(255, 255, 255, 255), alpha);
			if ( trace.Entity:GetNWBool("locked") ) then
				y = GAMEMODE:DrawInformation("Locked", "ChatFont", x, y, Color(255, 194, 14, 255), alpha);
			end
		[/lua]

Finally, add this to the ITEM script of every car:

[lua]ITEM.detail = “<text>”;[/lua]

This simple modification does this:
http://img101.imageshack.us/img101/3522/exorpvehiclev1.jpg

Uploaded with ImageShack.us

nice :smiley:

do you have a script so you can buy vehicles?