22.08.2012, 15:41
Quote:
I guess this is for RP servers , can you make it so it gives /unlock? I can't do it. Thanks in advance.
|
PHP код:
if (strcmp("/unlock", 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
SendClientMessage(playerid,-1,"Error: You are not in a vehicle!");//the error message.
}
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 == 0)//will check if the doors are already loocked it not.
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,true,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
SendClientMessage(playerid,-1,"Error: You are not in a vehicle!");//the error message.
}