/apark help -
DamonD - 04.09.2013
I have been messing around with this /apark ALL night, but can not get it... I am close but yet very far. This is what I have so far, and the normal /park CMD.
CMD:apark(so far)
Код:
CMD:apark(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 1337)
{
return SendClientMessageEx(playerid, COLOR_LIGHTRED, " You are not Authorized to use that command");
}
new ownerid = PlayerInfo[playerid][pVehicleKeysFrom];
if(IsPlayerConnected(ownerid))
{
{
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
if(IsARC(GetPlayerVehicleID(playerid))) // RC Vehicles
{
new Float:vehPos[3];
GetVehiclePos(GetPlayerVehicleID(playerid),vehPos[0], vehPos[1], vehPos[2]);
SetPlayerPos(playerid,vehPos[0], vehPos[1]+0.5, vehPos[2]+0.5);
}
GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
SetPlayerArmedWeapon(playerid, 0);
new string[29 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s has parked %s's vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
}
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
{
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(playerid, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], 0);
SetPlayerArmedWeapon(playerid, 0);
new string[30 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s has admin parked a vehicle.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
return 1;
}
The normal CMD
ark
Код:
CMD:park(playerid, params[])
{
if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
{
new ownerid = PlayerInfo[playerid][pVehicleKeysFrom];
if(IsPlayerConnected(ownerid))
{
new d = PlayerInfo[playerid][pVehicleKeys];
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[ownerid][d][pvId]))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Your vehicle is too damaged to park it.");
if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
if(IsARC(GetPlayerVehicleID(playerid))) // RC Vehicles
{
new Float:vehPos[3];
GetVehiclePos(GetPlayerVehicleID(playerid),vehPos[0], vehPos[1], vehPos[2]);
SetPlayerPos(playerid,vehPos[0], vehPos[1]+0.5, vehPos[2]+0.5);
}
GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
SetPlayerArmedWeapon(playerid, 0);
new string[29 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s has parked %s's vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
}
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
{
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Your vehicle is too damaged to park it.");
if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(playerid, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], 0);
SetPlayerArmedWeapon(playerid, 0);
new string[30 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s has parked their vehicle.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
SendClientMessageEx(playerid, COLOR_GREY, "You need to be inside a vehicle that you own.");
return 1;
}