2021-01-20, 12:15 AM
(This post was last modified: 2021-01-20, 12:16 AM by Disretired.)
Hello all, myself and a group of friends are working on a server and have noticed an issue with our park vehicle command.
The command only parks the car in Virtual World 0, we wanted to do dynamic garages, but when we /park in a garage with another VW other then 0 the car disappears and is parked in the VW 0 instead of the VW the garage is set too.
I've attached the command below if anyone can point out the issue, this is the command we had when we first started the project, I myself am still getting the hang of pawn so not sure what the problem is that's causing it to only park in VW 0.
The command only parks the car in Virtual World 0, we wanted to do dynamic garages, but when we /park in a garage with another VW other then 0 the car disappears and is parked in the VW 0 instead of the VW the garage is set too.
I've attached the command below if anyone can point out the issue, this is the command we had when we first started the project, I myself am still getting the hang of pawn so not sure what the problem is that's causing it to only park in VW 0.
Code:
CMD:park(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2 || PlayerInfo[playerid][pDonateRank] == 5)
{
new playerpark;
if(!sscanf(params, "i", playerpark))
{
for(new d = 0; d < MAX_PLAYERVEHICLES; d)
{
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerpark][d][pvId]))
{
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[playerpark][d][pvId], health);
if(PlayerInfo[playerpark][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerpark][pLockCar] = INVALID_VEHICLE_ID;
GetVehiclePos(PlayerVehicleInfo[playerpark][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[playerpark][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(playerpark, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, PlayerVehicleInfo[playerpark][d][pvId], 0);
SetPlayerArmedWeapon(playerid, 0);
new string[30 (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s has parked %s's vehicle for them.", GetPlayerNameEx(playerid), GetPlayerNameEx(playerpark));
new szMessage[128];
format(szMessage, sizeof(szMessage), "AdmCmd: %s has parked %s's vehicle for them", GetPlayerNameEx(playerid), GetPlayerNameEx(playerpark));
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be in a player owned vehicle");
}
else
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /park <playerid>");
}
else
SendClientMessageEx(playerid, COLOR_GRAD1, "Park is now an moderator command to combat abuse. /requesthelp or /am to an admin to get a car parked at your house.");
return 1;
}