14.01.2019, 00:55
I currently have this code:
But I wanted to remove "IsPlayerNearMercenary(playerid)" since I can't deal with it. It would be good if IsPlayerNearMercenary(playerid) can have many IsPlayerInRangeOfPoint, it's this:
I've tried it changing to this but it doesn't work:
Now to get back, that OnPlayerKeyStateChange, I want to change the part of "IsPlayerNearMercenary" to those different IsPlayerInRangeOfPoint, unless I know how to make IsPlayerNearMercenary work with different IsPlayerInRangeOfPoint. Thanks, I'll totally +rep who ever helps me how to do it.
PHP код:
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_WALK))
{
if(IsPlayerInAnyVehicle(playerid)) return 0;
new _mercID = IsPlayerNearMercenary(playerid);
if(_mercID == -1) return 0;
ShowPlayerMercenaryInv(playerid, _mercID);
}
return 1;
}
PHP код:
IsPlayerNearMercenary(playerid)
{
for(new i; i <MAX_MERCENARIES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, MercenaryInfo[i][mercPosX], MercenaryInfo[i][mercPosY], MercenaryInfo[i][mercPosZ]))
return i;
}
return -1;
}
PHP код:
IsPlayerNearMercenary(playerid)
{
for(new i; i <MAX_MERCENARIES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, -2817.39331, -1516.39526, 140.74620))
if(IsPlayerInRangeOfPoint(playerid, 1.5, -2386.69141, 2216.22852, 5.07300))
if(IsPlayerInRangeOfPoint(playerid, 1.5, 499.88400, -223.22240, 13.35980))
if(IsPlayerInRangeOfPoint(playerid, 1.5, -417.85309, -1754.71997, 6.46650))
if(IsPlayerInRangeOfPoint(playerid, 1.5, -663.98370, 2316.17261, 138.87550))
return i;
}
return -1;
}