Car Lock help
#3

You just did something very long, you should make something more simple like this

Код:
if (strcmp("/lock", cmdtext, true, 10) == 0)//your command. 
    { 
        new engine, lights, alarm, doors, bonnet, boot, objective; 
        new vehicleid = GetPlayerVehicleID(playerid);//defining vehicleid is = to GetPlayerVehicleID. 
        if(IsPlayerInAnyVehicle(playerid))//Thsi will check that is a player In a vehcile or not. 
            { 
                GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);//will check that what is the state of the vehicle lock. 
                if(doors == 1)//will check if the doors are already loocked it not. 
                { 
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective); 
                      SetVehicleParamsEx(vehicleid,engine,lights,alarm,false,bonnet,boot,objective);//same as the engine one. 
                      GameTextForPlayer(playerid,"Vehicle Unlocked!",2000,6);//for a text to appar on the screen for only 2 seconds. 
                       return 1; 
                } 
                else 
                SetVehicleParamsEx(vehicleid,engine,lights,alarm,true,bonnet,boot,objective); 
                GameTextForPlayer(playerid,"Vehicle Locked!",2000,6);//for a text to appar on the screen for only 2 seconds. 
            } 
            else 
            SendClientMessage(playerid,-1,"Error: You are not in a vehicle!");//the error message. 
    } 
    return 0; 
}
Reply


Messages In This Thread
Car Lock help - by ThePrograme - 02.02.2013, 11:15
Re: Car Lock help - by ThePrograme - 02.02.2013, 12:24
Re: Car Lock help - by iManakoss - 02.02.2013, 12:41
Re: Car Lock help - by ThePrograme - 02.02.2013, 15:36
Re: Car Lock help - by ThePrograme - 02.02.2013, 16:04
Re: Car Lock help - by T0pAz - 02.02.2013, 16:21
Re: Car Lock help - by ThePrograme - 02.02.2013, 16:27

Forum Jump:


Users browsing this thread: 1 Guest(s)