Como fazer Pickup - Mateus Santos - 27/04/2024
Como coletar no spawn do veículo, muda automaticamente de forma aleatória (Pickup)
Código: new trocarVeh;
new RandomVeh[] = {411, 400, 402, 404, 415, 418, 422, 424, 434, 444, 451, 457, 482, 495, 508, 514, 535, 541, 560, 573, 601, 571, 562};
OnGamemodeInit
trocarVeh = CreatePickup(12957, 1, -1461.8420,-523.9481,14.1776, 0);
OnPlayerPickUpPickup
if (pickupid == trocarVeh)
{
new vehicleId = AddStaticVehicle(RandomVeh[random(sizeof(RandomVeh))], -1449.7061,-526.0865,14.1719, 1, 1, 0);
PutPlayerInVehicle(playerid, vehicleId, 0);
}
IMG
https://ibb.co/ryJ3GCP
Video, talvez 2 dias expirado D:
https://streamable.com/nsomqr
Os veículos não mudam automaticamente? sem OnFoot?, acho que funciona quando o OnFoot é trocado no veículo, tem como sem OnFoot?
RE: Como fazer Pickup - casti3l - 27/04/2024
if (pickupid == trocarVeh){
new rand = random(sizeof(RandomVeh));
new vehicleId = AddStaticVehicle(RandomVeh[rand], 817.2750,-1343.9915,13.5272, 1, 1, 0);
PutPlayerInVehicle(playerid, vehicleId, 0);
}
RE: Como fazer Pickup - samuelmatheus0502 - 27/04/2024
acho que você queria destruir o veiculo antigo certo?
se for isso use essa linha junto ao se código de criação do véiculo
Código: // adcionado essa linha DestroyVehicle(vehicleId);
if (pickupid == trocarVeh){
DestroyVehicle(vehicleId);
new rand = random(sizeof(RandomVeh));
new vehicleId = AddStaticVehicle(RandomVeh[rand], 817.2750,-1343.9915,13.5272, 1, 1, 0);
PutPlayerInVehicle(playerid, vehicleId, 0);
}
você está usando um nome de variável que em algumas publics isso é parametro e não é muito legal, só uma dica mesmo... você poderia usar um nome mais interessante
RE: Como fazer Pickup - Carlos Victor - 27/04/2024
Código PHP: new g_arrVehiclesRandom[] = { 411, 400, 402, 404, 415, 418, 422, 424, 434, 444, 451, 457, 482, 495, 508, 514, 535, 541, 560, 573, 601, 571, 562 };
new pickupChangeVehicle; new gPlayerVehicle[MAX_PLAYERS];
public OnGameModeInit() { pickupChangeVehicle = CreatePickup(12957, 1, -1461.8420, -523.9481, 14.1776, 0); return 1; }
public OnPlayerDisconnect(playerid, reason) { if (IsValidVehicle(gPlayerVehicle[playerid])) { DestroyVehicle(gPlayerVehicle[playerid]); gPlayerVehicle[playerid] = INVALID_VEHICLE_ID; } return 1; }
public OnPlayerPickUpPickup(playerid, pickupid) { if (pickupid == pickupChangeVehicle && GetPlayerVehicleID(playerid) == gPlayerVehicle[playerid]) { if (IsValidVehicle(gPlayerVehicle[playerid])) DestroyVehicle(gPlayerVehicle[playerid]);
new gRandom = random(sizeof(g_arrVehiclesRandom));
gPlayerVehicle[playerid] = AddStaticVehicle(g_arrVehiclesRandom[gRandom], -1449.7061,-526.0865,14.1719, 1, 1, 0); PutPlayerInVehicle(playerid, gPlayerVehicle[playerid], 0); } return 1; }
RE: Como fazer Pickup - Mateus Santos - 27/04/2024
Assim obrigado! vou pensa ckeckpoint https://www.open.mp/docs/scripting/functions/SetPlayerCheckpoint
|