Ice-cup Geplaatst: 28 januari 2011 Rapport Geplaatst: 28 januari 2011 public IsVehicleInRadius(Float:radi, playerid, Float:x, Float:y, Float:z) { if(IsPlayerConnected(playerid)) { for(new c=0;c<MAX_VEHICLES;c++) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetVehiclePos(c,oldposx, oldposy, oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } } return 0; } Hoord te werken bij de volgene stuk van een command: else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); if(doors == 0) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x,y,z); if(IsVehicleInRadius(5.0, playerid,x,y,z)) { if(PlayerInfo[playerid][pCar] == DynamicCars[VehicleLockedPlayer[playerid]][CarID]) { if(PlayerInfo[playerid][pSex] == 1) { PlayerActionMessage(playerid,15.0,"has just unlocked his vehicle."); } else { PlayerActionMessage(playerid,15.0,"has just unlocked her vehicle."); } SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[iNFO:] Vehicle Unlocked."); SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF); } else { SendClientMessage(playerid, COLOR_RED, "You do not have the keys for this vehicle!"); } } } Wat is hier mis? Het is technisch gezien hetzelfde als de PlayerToPoint functie.. Toch? Reageren
Big Boss Geplaatst: 28 januari 2011 Rapport Geplaatst: 28 januari 2011 Je kan beter je functie hernoemen en herstructureren naar IsPlayerInRangeOfVehicle. stock IsPlayerInRangeOfVehicle(playerid, vehicleid, Float:radius) { new Float:x, Float:y, Float:z; GetVehiclePos(vehicleid, x, y, z); return IsPlayerInRangeOfPoint(playerid, radius, x, y, z); } if(IsPlayerInRangeOfVehicle(playerid, PlayerInfo[playerid][pCar], 5.0) // Kijkt of de player binnen 5 meter van zijn auto is { if(PlayerInfo[playerid][pCar] == DynamicCars[VehicleLockedPlayer[playerid]][CarID]) { // Doe je ding } } Reageren
Ice-cup Geplaatst: 29 januari 2011 Auteur Rapport Geplaatst: 29 januari 2011 Mhm nog steeds Unknown command. Denk dat er dus eerder wat mis is met het commandje; if(strcmp(cmd, "/lock", true) == 0) { new carid=GetPlayerVehicleID(playerid); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(PlayerInfo[playerid][pCar] == DynamicCars[carid][CarID]) { GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); if(doors == 0) { if(PlayerInfo[playerid][pSex] == 1) { PlayerActionMessage(playerid,15.0,"has just locked his vehicle."); } else { PlayerActionMessage(playerid,15.0,"has just locked her vehicle."); } SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[iNFO:] Vehicle Locked."); SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_ON,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF); } else { if(PlayerInfo[playerid][pSex] == 1) { PlayerActionMessage(playerid,15.0,"has just unlocked his vehicle."); } else { PlayerActionMessage(playerid,15.0,"has just unlocked her vehicle."); } SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[iNFO:] Vehicle unlocked."); SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF); } } else { SendClientMessage(playerid, COLOR_RED, "You do not have the keys for this vehicle!"); } } else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); if(doors == 0) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x,y,z); if(IsPlayerInRangeOfVehicle(playerid, PlayerInfo[playerid][pCar], 5.0)) { if(PlayerInfo[playerid][pCar] == DynamicCars[VehicleLockedPlayer[playerid]][CarID]) { if(PlayerInfo[playerid][pSex] == 1) { PlayerActionMessage(playerid,15.0,"has just unlocked his vehicle."); } else { PlayerActionMessage(playerid,15.0,"has just unlocked her vehicle."); } SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[iNFO:] Vehicle Unlocked."); SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF); } else { SendClientMessage(playerid, COLOR_RED, "You do not have the keys for this vehicle!"); } } } else { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x,y,z); if(IsPlayerInRangeOfVehicle(playerid, PlayerInfo[playerid][pCar], 5.0)) { if(PlayerInfo[playerid][pCar] == DynamicCars[VehicleLockedPlayer[playerid]][CarID]) { if(PlayerInfo[playerid][pSex] == 1) { PlayerActionMessage(playerid,15.0,"has just locked his vehicle."); } else { PlayerActionMessage(playerid,15.0,"has just locked her vehicle."); } SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[iNFO:] Vehicle locked."); SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_ON,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF); } else { SendClientMessage(playerid, COLOR_RED, "You do not have the keys for this vehicle!"); } } } } return 1; } Reageren
Ice-cup Geplaatst: 2 februari 2011 Auteur Rapport Geplaatst: 2 februari 2011 Aantal dagen zijn verstreken en zit nog steeds met hetzelfde probleem . Als ik dit soort callbacks wil begrijpen, en waarom ze fout zijn wil ik deze oplossen. Kan iemand hier aub nog eventjes naar kijken? . Reageren
Recommended Posts
Een reactie plaatsen
Je kan nu een reactie plaatsen en pas achteraf registreren. Als je al lid bent, log eerst in om met je eigen account een reactie te plaatsen.