Quote:
Originally Posted by fysiks
There are no issues with the code that you have posted (assuming you have it complete which it isn't in the posted code).
I.E. This compiles just fine:
Code:
public make_hero(id)
{
switch (random_num(0, 1))
{
case 0:
{
// stuff 0
}
case 1:
{
// stuff 1
}
}
}
|
But there is a problem, you cant add more then 1 thing lets say if i do like this :
Code:
case 0:
{
1 thing
1 thing
1 thing
}
If i compile it. it will show this error :
Code:
// C:\Users\Billy\Desktop\Compiler\zp_hero.sma(65) : error 002: only a single st
atement (or expression) can follow each "case"
But i want it to select a hero randomly.
meaning i want it to select 2 tasks randomly.
1st task will switch the player model to hero and gives a svdex dual deagle etc.
2nd task will switch the player model to "heroine" and gives a quad barrel and dual deagle etc.
hope you understand better now. im bad at explaining, sorry for that.
EDIT! :
Got an idea, If i do it like this :
setting 2 tasks
set_task(0.5,"make_hero")
set_task(0.5,"make_heroine")
Then the
public make_heroine(id)
etc-.-
But im gonna need a code that randomizes what task to choose.
I coded the plugin to make 2 hero's now, but i need something that can randomize what task to use.
Will this work? correct the code if not please.
Code:
public random_task(id)
{
switch (random_num(0, 1))
{
case 0:
{
set_task(0.5,"make_heroine")
}
case 1:
{
set_task(0.5,"make_hero")
}
}
}
That compiled great, but will it work?
EDIT 2 :
So that was wrong, it had already set the tasks before my code above. so i change it to this.
Code:
public zp_round_started(round)
{
if (zp_get_human_count( ) < MINPEOPLE )
return;
if(round == MODE_MULTI || round == MODE_INFECTION)
switch (random_num(0, 1))
{
case 0:
{
set_task(0.5,"make_heroine") ;
}
case 1:
{
set_task(0.5,"make_hero");
}
}
}
That should do it right?
__________________