Random Zone bonus - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random Zone bonus (
/showthread.php?tid=612760)
Random Zone bonus -
Hunud - 21.07.2016
How do i create random zone bonus example i was trying smth but no work ;(
Re: Random Zone bonus -
UltraScripter - 21.07.2016
PHP код:
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
}
Re: Random Zone bonus -
moura98 - 21.07.2016
Quote:
new Zones[][]
{
0.0, 0.0, 0.0,
1.1, 1.1, 1.1,
2.2, 2.2, 2.2
}
|
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
}
Re: Random Zone bonus -
UltraScripter - 21.07.2016
Quote:
Originally Posted by moura98
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
}
|
Ohh yea I sorry my mistake
Re: Random Zone bonus -
Hunud - 21.07.2016
What about this? if i insert this on gm it will work ?
Quote:
#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;
}
|
Re: Random Zone bonus -
moura98 - 21.07.2016
Quote:
Originally Posted by UltraScripter
Ohh yea I sorry my mistake
|
don't worry, this is normal
Re: Random Zone bonus -
F1N4L - 21.07.2016
Quote:
Originally Posted by UltraScripter
PHP код:
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
}
|
Quote:
Originally Posted by moura98
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
}
|
It's wrong!
The correct code is:
Код:
new Float:Zones[][] =
{
{0.0, 0.0, 0.0},
{1.1, 1.1, 1.1},
{2.2, 2.2, 2.2}
};
or
Код:
new Float:Zones[] =
{
0.0, 0.0, 0.0,
1.1, 1.1, 1.1,
2.2, 2.2, 2.2
};
Re: Random Zone bonus -
Hunud - 21.07.2016
This my code above will work ?
Re: Random Zone bonus -
Hunud - 21.07.2016
BUMP!