30.08.2011, 19:45
Quote:
i dont know how to make /Park but here is a go at Lock
Код:
if(strcmp(cmd, "/car", true) == 0) { if(IsPlayerConnected(playerid)) { new x_nr[32]; x_nr = strtok(cmdtext, idx); new veh = GetPlayerVehicleID(playerid); new engine,lights,alarm,doors,hood,trunk,objective; if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /car [name]"); SendClientMessage(playerid, COLOR_GRAD1, "Available names: Engine, Lights, Hood, Trunk"); return 1; } if(strcmp(x_nr,"engine",true) == 0) { if(GetPVarInt(playerid, "Engine") == 0) { GetPlayerVehicleID(playerid); GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,hood,trunk,objective); SetPVarInt(playerid, "Engine", 1); } else if(GetPVarInt(playerid, "Engine") == 1) { GetPlayerVehicleID(playerid); GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,hood,trunk,objective); SetPVarInt(playerid, "Engine", 0); } return 1; } if(strcmp(x_nr,"lights",true) == 0) { if(GetPVarInt(playerid, "Lights") == 0) { GetPlayerVehicleID(playerid); GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,hood,trunk,objective); SetPVarInt(playerid, "Lights", 1); } else if(GetPVarInt(playerid, "Lights") == 1) { GetPlayerVehicleID(playerid); GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,hood,trunk,objective); SetPVarInt(playerid, "Lights", 0); } return 1; } if(strcmp(x_nr,"hood",true) == 0) { if(GetPVarInt(playerid, "Hood") == 0) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,trunk,objective); SetPVarInt(playerid, "Hood", 1); } else if(GetPVarInt(playerid, "Hood") == 1) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,trunk,objective); SetPVarInt(playerid, "Hood", 0); } return 1; } if(strcmp(x_nr,"trunk",true) == 0) { if(GetPVarInt(playerid, "Trunk") == 0) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,VEHICLE_PARAMS_ON,objective); SetPVarInt(playerid, "Trunk", 1); } else if(GetPVarInt(playerid, "Trunk") == 1) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,VEHICLE_PARAMS_OFF,objective); SetPVarInt(playerid, "Trunk", 0); } } if(strcmp(x_nr,"lock",true) == 0) { if(GetPVarInt(playerid, "Doors") == 0) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,VEHICLE_PARAMS_ON,objective); SetPVarInt(playerid, "Doors", 1); } else if(GetPVarInt(playerid, "Lock") == 1) { GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective); SetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,VEHICLE_PARAMS_OFF,objective); SetPVarInt(playerid, "Doors", 0); } } else { SendClientMessage(playerid, COLOR_GREY, " Invalid /car function !"); return 1; } } return 1; } |