10.07.2011, 02:44
Код:
if(strcmp(cmd, "/car", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /car [name"); SendClientMessage(playerid, COLOR_GRAD2, "Available division names: lights,hood,trunk"); return 1; } if(strcmp(params, "lights", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle."); SetVehicleLights(vehicleid, playerid); } else if(strcmp(params, "hood", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || IsAPlane(vehicleid) || IsABike(vehicleid)) { return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle."); } SetVehicleHood(vehicleid, playerid); } else if(!IsPlayerInAnyVehicle(playerid)) { new closestcar = GetClosestCar(playerid); if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0)) { if(GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510 || IsAPlane(closestcar) || IsABike(closestcar)) { return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used on this vehicle."); } SetVehicleHood(closestcar, playerid); } } else if(strcmp(params, "trunk", true) == 0) { if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) { return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle."); } SetVehicleTrunk(vehicleid, playerid); } else if(!IsPlayerInAnyVehicle(playerid)) { new closestcar = GetClosestCar(playerid); if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0)) { if(GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510) { return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used on this vehicle."); } SetVehicleTrunk(closestcar, playerid); } } } return 1; }