21.07.2012, 10:59
O comando /acarpark < й sу para admins, podemos estacionar o carro onde queremos
Eu tento estacionar onde eu quero mais ele desaparece. antes disso eu crio o carro /criarcarro id modelo
depois eu tento estacionar e desaparece ou as vezes estaciona o carro errado
Codigo do /acarpark
Codigo /criarcarro:
Eu tento estacionar onde eu quero mais ele desaparece. antes disso eu crio o carro /criarcarro id modelo
depois eu tento estacionar e desaparece ou as vezes estaciona o carro errado
Codigo do /acarpark
Код:
if(strcmp(cmd, "/acarpark", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 5) { if(IsPlayerInAnyVehicle(playerid)) { if(Car[GetPlayerVehicleID(playerid)][Owned] == 1) { new carid = GetPlayerVehicleID(playerid); SendClientMessage(playerid, COLOR_YELLOW2, "Estacionaste o carro com sucesso."); new Float:x,Float:y,Float:z; new Float:a; GetVehiclePos(carid, x, y, z); GetVehicleZAngle(carid, a); Car[carid][CarModel] = GetVehicleModel(carid); Car[carid][CarID] = GetPlayerVehicleID(playerid); Car[carid][ParkX] = x; Car[carid][ParkY] = y; Car[carid][ParkZ] = z; Car[carid][ParkAngle] = a; DestroyVehicle(carid); Car[carid][CarID] = CreateVehicle(Car[carid][CarModel],Car[carid][ParkX],Car[carid][ParkY],Car[carid][ParkZ],Car[carid][ParkAngle],Car[carid][CarColor1],Car[carid][CarColor2], -1); SetVehicleModifications(carid); if(DynamicCars[carid-1][cPaintjob] != 999) { ChangeVehiclePaintjob(carid, DynamicCars[carid-1][cPaintjob]); } PutPlayerInVehicle(playerid,carid,0); SaveDynamicCars(); } else { new vehicleid = GetPlayerVehicleID(playerid); new car = GetPlayerVehicleID(playerid) - 1; new Float:x,Float:y,Float:z; new Float:a; GetVehiclePos(vehicleid, x, y, z); GetVehicleZAngle(vehicleid, a); DynamicCars[car][CarX] = x; DynamicCars[car][CarY] = y; DynamicCars[car][CarZ] = z; DynamicCars[car][CarAngle] = a; DestroyVehicle(vehicleid); CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1); PutPlayerInVehicle(playerid,vehicleid,0); SetVehicleModifications(vehicleid); SetVehicleMatricula(vehicleid); if(DynamicCars[vehicleid-1][cPaintjob] != 999) { ChangeVehiclePaintjob(vehicleid, DynamicCars[vehicleid-1][cPaintjob]); } SaveDynamicCars(); new wstring[128]; format(wstring, sizeof(wstring), "Tu escolheste o veiculo ID: %d e estaciona-te o aqui.", vehicleid); SendClientMessage(playerid,COLOR_ADMINCMD, wstring); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo esta num veiculo!"); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Tu nгo es administrador."); } } return 1; }
Код:
if(strcmp(cmd, "/criarcarro", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[Comando]: /criarcarro [carid] [modelid]"); return 1; } new vehicleid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[Comando]: /criarcarro [carid] [modelid]"); return 1; } new thecar = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 15) { if(thecar > 399 && thecar < 612) { new wstring[128]; new car = vehicleid - 1; if(DynamicCars[car][CarModel] != 0) { format(wstring, sizeof(wstring), "O veiculo com o ID %d jб existe no server com o modelo: %d.", vehicleid,thecar); SendClientMessage(playerid,COLOR_ADMINCMD, wstring); return 1; } DynamicCars[car][CarModel] = thecar; format(wstring, sizeof(wstring), "Tu criaste um veiculo com o ID %d e o modelo: %d.", vehicleid,thecar); SendClientMessage(playerid,COLOR_ADMINCMD, wstring); new Float:x,Float:y,Float:z; new Float:a; GetPlayerPos(playerid, x, y, z); if(IsPlayerInAnyVehicle(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), a); } else { GetPlayerFacingAngle(playerid, a); } DynamicCars[car][CarX] = x; DynamicCars[car][CarY] = y; DynamicCars[car][CarZ] = z; DynamicCars[car][CarAngle] = a; DestroyVehicle(vehicleid); CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1); SetVehicleModifications(vehicleid); SetVehicleMatricula(vehicleid); if(DynamicCars[vehicleid][cPaintjob] != 999) { ChangeVehiclePaintjob(vehicleid, DynamicCars[car][cPaintjob]); } SaveDynamicCars(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Incorrecto Modelo ID, Model ID's: 400-611."); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Tu nгo es administrador."); } } return 1; }