07.08.2017, 04:47
Sometimes when I create a car it will erase it from another player
here the code, help me pls
here the code, help me pls
Код:
enum _@en@cuenta { cCoche }; ///////////////// new static cuenta[MAX_PLAYERS][_@en@cuenta]; ///////////////// public OnVehicleSpawn(vehicleid) { for(new i=0,t=GetMaxPlayers(); i<t; i++) { if(!IsPlayerConnected(i)) continue; { if(vehicleid == cuenta[i][cCoche]) { DestroyVehicle(vehicleid); } } } return 1; } stock GenerarAuto(playerid, modelo, Float:vida) { if(IsPlayerInAnyVehicle(playerid)) { Mensaje(playerid, Rojo, "[Advertencia]: Usted ya esta dentro de un vehiculo, baje para crear uno!."); return false; } else { new Float:x, Float:y, Float:z, Float:angle; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); DestroyVehicle(cuenta[playerid][cCoche]); cuenta[playerid][cCoche] = CreateVehicle(modelo, x, y, z+2, angle, -1, -1, -1); SetVehicleHealth(cuenta[playerid][cCoche], vida); SetVehicleVirtualWorld(cuenta[playerid][cCoche], GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(cuenta[playerid][cCoche], GetPlayerInterior(playerid)); PutPlayerInVehicle(playerid, cuenta[playerid][cCoche], 0); return true; } }