21.07.2016, 12:43
How do i create random zone bonus example i was trying smth but no work ;(
new Zones[][]
{
0.0, 0.0, 0.0,
1.1, 1.1, 1.1,
2.2, 2.2, 2.2
}
new rand;
rand = random(sizeof(Zones));
if(IsPlayerInRangeOfPoint(playerid, 10.0, zones[rand][0], zones[rand][1], zones[rand][2]))
{
//your bonus code
}
|
new Zones[][] { 0.0, 0.0, 0.0, 1.1, 1.1, 1.1, 2.2, 2.2, 2.2 } |
new Float:Zones[][]
{
0.0, 0.0, 0.0,
1.1, 1.1, 1.1,
2.2, 2.2, 2.2
}
|
#define MAX_WAR 100 new SpecialZone[MAX_WAR]; stock AvailableZone(id) { switch(id) { case SnakeFarm: return 1; } return 0; } public SpecialTimer() { new i = random(MAX_WAR+1); new string[128]; if(AvailableZone(i) == 1) { if(SpecialZone[i] == 0) { format(string, sizeof(string), "* Zone %s is now a bonus zone, Capture it to get a special/additional rewards.", GetZoneName(i)); SendClientMessageToAll(COLOR_PINK, string); SpecialZone[i] = 1; print(string); } else { format(string, sizeof(string), "* Zone %s is no longer a bonus zone, It will be replaced in the next 3 minutes.", GetZoneName(i)); SendClientMessageToAll(COLOR_PINK, string); SpecialZone[i] = 0; print(string); } } else { SpecialTimer(); } return 1; } |
|
PHP код:
|
|
the correct is:
PHP код:
|
new Float:Zones[][] =
{
{0.0, 0.0, 0.0},
{1.1, 1.1, 1.1},
{2.2, 2.2, 2.2}
};
new Float:Zones[] =
{
0.0, 0.0, 0.0,
1.1, 1.1, 1.1,
2.2, 2.2, 2.2
};