25.05.2013, 04:59
What you should be using for readability is like this..
pawn Код:
enum DROPINFO {
Float:DropX,
Float:DropY,
Float:DropZ,
Float:DropCPSize
}
stock const RandomDropOff[][DROPINFO] =
{
{1609.1157,1642.1429,10.8203, 10.0},
{404.6019,2483.4902,16.4844, 10.0},
{-1345.8822,-522.7991,14.1484,10.0},
{-1051.5347,-1195.1558,129.0394,10.0}
};
CMD:startflight(playerid, params[])
{
SetRandomDropCP(playerid);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(IsDropCP(playerid))
{
// Do whatever you need now
SetRandomDropCP(playerid);
}
return 1;
}
stock SetRandomDropCP(playerid)
{
new random(sizeof(RandomDropOff));
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, RandomDropOff[rand][DropX], RandomDropOff[rand][DropY], RandomDropOff[rand][DropZ], RandomDropOff[rand][DropCPSize]);
return 1;
}
stock IsDropCP(playerid)
{
for(new i = 0; i < sizeof(RandomDropOff); i++)
{
if(IsPlayerInRangeOfPoint(playerid, RandomDropOff[i][DropCPSize] / 2, RandomDropOff[i][DropX], RandomDropOff[i][DropY], RandomDropOff[i][DropZ])
{
return 1;
}
}
return 0;
}