Engine restriction
#1

Hello, I have this command for the engine and I want to make that, car owners can only acces their car with the dupe key and faction member can also access their personal cars and faction cars. I made this but it's not working.

Any help ?

Код:
COMMAND:engine(playerid, params[])
{
 new vehicleid = GetPlayerNearestVehicle(playerid);
	new xr = GetPlayerVehicleID(playerid);
	new engine,lights,alarm,doors,bonnet,boot,objective;
	new sender[MAX_STRING];
	if(Vehicles[GetPlayerVehicleID(playerid)][carteam] != PlayerInfo[playerid][playerteam]) return SendClientError(playerid, "You can't drive this vehicle");
	if(strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && strcmp(PlayerName(playerid),Vehicles[vehicleid][dupekey],false)) return SendClientError(playerid, "You do not own this vehicle and you don't have the keys!");
	if(PlayerTemp[playerid][hname]==1) myStrcpy(sender,"Stranger");
	else myStrcpy(sender,NameEx(playerid));
	if(IsPlayerInAnyVehicle(playerid) && Vehicles[xr][carmodel] != 481)
	{
	    new stringa[MAX_STRING];
    	new vid = GetPlayerVehicleID(playerid);
    	GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
		//if(VehicleInfo[vid][iBroken]==1) return SendClientError(playerid,"Engine can not be started, Engine is broken");
    	if(engine == 0)
    	{
			    SetVehicleParamsEx(vid, 1, lights, alarm, doors, bonnet, boot, objective);
		     	format(stringa,sizeof(stringa),"%s has turned the engine on.",sender);
		     	NearMessage(playerid,stringa,COLOR_ME2);
		}
		else
    	{
			SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, objective);
			format(stringa,sizeof(stringa),"%s has turned the engine off.",sender);
			NearMessage(playerid,stringa,COLOR_ME2);
    	}
	}
	return 1;
}
If I enter personal car it works but if I enter faction car that I can enter, this is what is gives me "You do not own this vehicle and you don't have the keys!" Which is wrong from what I wrote...
Reply
#2

Faction Members get dupe keys of the faction vehicles? Because I don't see anything related to factions in the line that has the message "You do not own this vehicle...". If not, explain to me what I'm missing...
Reply
#3

This should be the faction condition. Faction members should be able to start the engine with no problem, without that condition which is for personal cars that you can give dupe keys.
Код:
if(Vehicles[GetPlayerVehicleID(playerid)][carteam] != PlayerInfo[playerid][playerteam]) return SendClientError(playerid, "You can't drive this vehicle");
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)