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


Messages In This Thread
Engine restriction - by xdarren - 18.06.2014, 17:40
Re: Engine restriction - by Abagail - 18.06.2014, 18:36
Re: Engine restriction - by xdarren - 18.06.2014, 19:42

Forum Jump:


Users browsing this thread: 1 Guest(s)