16.11.2013, 13:39
When I combine this 2 commands it bugs with other commands eg spawning a car with /veh. I just want /boot to open the boot and when I do it again it has to close the boot.
Код:
if(strcmp(cmd, "/boot", true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a car before you can do this!"); if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!"); { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "> %s Presses on the trunk button and opens it.", RemoveUnderScore(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); // |||||| SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective); } return 1; } if(strcmp(cmd, "/closeboot", true) == 0 || strcmp(cmd, "/cboot", true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a car before you can do this!"); if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!"); { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "> %s Presses on the trunk button and closes it.", RemoveUnderScore(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); // |||||| SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective); } return 1; }
Код:
if(strcmp(cmd, "/boot", true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a car before you can do this!"); if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!"); { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "> %s Presses on the trunk button and opens it.", RemoveUnderScore(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); // |||||| SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective); } return 1; } else { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a car before you can do this!"); if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!"); { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "> %s Presses on the trunk button and closes it.", RemoveUnderScore(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); // |||||| SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective); } return 1; }