start engine cmd
#1

Hello,

I am doing an rp server and I scripted a engine command in it. Whenever someone types /engine, it will check weather he is obliged to do so, and if yes, it will return public startingengine. The thing is that it does nothing.
Код:
public startingengine(playerid)
{
	SendClientMessage(playerid,COLOR_GREEN,"public startingengine(playerid) started...");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"Musнљ byќ vo vozidle aby si naљtartoval motor.");
	new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
	if(IsVehicleRental(GetPlayerVehicleID(playerid)))
	{
	    SendClientMessage(playerid,COLOR_ORANGE,"Vehicle Is Rental");
 		if(random(6)==1)
   		{
   		    SendClientMessage(playerid,COLOR_ORANGE,"random(6)==1");
     		new name[25];
       		new enginestring[40];
       		new Float:x,Float:y,Float:z;
			GetPlayerName(playerid,name,sizeof(name));
			format(enginestring,sizeof(enginestring),"%s nenaљtartoval motor.");
			GetPlayerPos(playerid,x,y,z);
			for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerInRangeOfPoint(i,30,x,y,z)) SendClientMessage(i,COLOR_PURPLE,enginestring);
			return 1;
 		}
		else
  		{
  		    SendClientMessage(playerid,COLOR_ORANGE,"random(6)!=1");
    		new name[25];
      		new enginestring[40];
        	new Float:x,Float:y,Float:z;
			GetPlayerName(playerid,name,sizeof(name));
			format(enginestring,sizeof(enginestring),"%s naљtartoval motor.");
			GetPlayerPos(playerid,x,y,z);
			for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerInRangeOfPoint(i,30,x,y,z)) SendClientMessage(i,COLOR_PURPLE,enginestring);
			SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,1,alarm,doors,bonnet,boot,objective);
			return 1;
	    }
	}
	else // player owned vehicle
	{
	    SendClientMessage(playerid,COLOR_ORANGE,"Vehicle is not rental.");
	    if(random(6)==1||VehicleInfo[PlayerInfo[playerid][pVeh1]][Fuel]<1)
	    {
	        SendClientMessage(playerid,COLOR_ORANGE,"random(6)==1||VehicleInfo[fuel]<1");
	    	new name[25];
   		    new enginestring[40];
   		    new Float:x,Float:y,Float:z;
			GetPlayerName(playerid,name,sizeof(name));
			format(enginestring,sizeof(enginestring),"%s nenaљtartoval motor.");
			GetPlayerPos(playerid,x,y,z);
			for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerInRangeOfPoint(i,30,x,y,z)) SendClientMessage(i,COLOR_PURPLE,enginestring);
			if(VehicleInfo[PlayerInfo[playerid][pVeh1]][Fuel]<1) SendClientMessage(playerid,COLOR_RED,"Vo vozidle nieje benzнn.");
			return 1;
		}
		else
		{
		    SendClientMessage(playerid,COLOR_ORANGE,"random(6)!=1");
		    new name[25];
      		new enginestring[40];
        	new Float:x,Float:y,Float:z;
			GetPlayerName(playerid,name,sizeof(name));
			format(enginestring,sizeof(enginestring),"%s naљtartoval motor.");
			GetPlayerPos(playerid,x,y,z);
			for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerInRangeOfPoint(i,30,x,y,z)) SendClientMessage(i,COLOR_PURPLE,enginestring);
			SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,1,alarm,doors,bonnet,boot,objective);
			VehicleInfo[PlayerInfo[playerid][pVeh1]][Engine]=0;
			new INI:File=INI_Open(VehiclePath(PlayerInfo[playerid][pVeh1]));
			INI_SetTag(File,"Vehicle Info Save");
			INI_WriteInt(File,"Engine",1);
			INI_Close(File);
			fueltimer[GetRealVehicleID(GetPlayerVehicleID(playerid))]=SetTimerEx("fuelconsumption",120000,1,"i",GetRealVehicleID(GetPlayerVehicleID(playerid)));
			return 1;
		}
	}
}
I put there
Код:
SendClientMessage(playerid,COLOR_GREEN,"public startingengine(playerid) started...");
to even check if the public starts, and it does. But it doesnt do nothing else besides that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)