Make 2 tasks chosen randomly. (Solved)
How do i make 2 tasks, and those will be generated randomly?.
like this one, but this one does not work, only 1 expression or statement can be used in 1 "case", possible to change that? the code Code:
public make_hero(id)this is amxmodx 1.8.2, tell me if you know any natives that can make this possible. 2 hero's. chosen randomly to players. |
Re: Make 2 tasks chosen randomly. (how?)
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) |
Re: Make 2 tasks chosen randomly. (how?)
Quote:
Code:
case 0:Code:
// C:\Users\Billy\Desktop\Compiler\zp_hero.sma(65) : error 002: only a single stmeaning 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) 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) |
Re: Make 2 tasks chosen randomly. (how?)
Quote:
EDIT: If I had to guess, you are not closing all of your braces. HINT: The switch that you posted is not complete. If that hint doesn't help, attach your whole plugin |
Re: Make 2 tasks chosen randomly. (how?)
I cant do that, its my private.
Quote:
I have made 2 plugins in 1. 1 for heroine and 1 for hero. And with the code above, it should randomize the tasks right?. Then it should work like i want. EDIT : i guess i forgot about the closing bracets, only used 1 for it. but this should work the same way, just a bit more complicated. |
Re: Make 2 tasks chosen randomly. (how?)
You should avoid using set_task() if you can.
|
Re: Make 2 tasks chosen randomly. (how?)
Quote:
EDIT: That worked too, so i guess i will be testing soon. |
Re: Make 2 tasks chosen randomly. (how?)
Quote:
|
Re: Make 2 tasks chosen randomly. (how?)
Quote:
Code:
public zp_round_started(round)Code:
//// zp_addon_heros.sma |
Re: Make 2 tasks chosen randomly. (how?)
Most of the errors you have there are trivial and caused by a lack of basic knowledge of scripting. You need to completely redo that whole function instead of copy/pasting stuff. After you redo the function, if you still have errors, try to read what the error says and try to fix it. It would probably help if you used consistent indentation too.
|
| All times are GMT -4. The time now is 20:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.