Raised This Month: $ Target: $400
 0% 

random_num ArrayGetString


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gasa
Senior Member
Join Date: Sep 2013
Old 11-22-2013 , 11:55   random_num ArrayGetString
Reply With Quote #1

Hey allied, can somone help me to get next model from array, this only make random, and also is it possible when i get next till end to start from first again thanx in advaance

PHP Code:
rand_mdl random_num(0ArraySize(g_sPropsModel) - 1)
ArrayGetString(g_sPropsModelrand_mdlszEntModelcharsmax(szEntModel)); 
Gasa is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 11-22-2013 , 12:45   Re: random_num ArrayGetString
Reply With Quote #2

0 is the first string of the array
(ArraySize(g_sPropsModel) - 1) value is the last string of the array.

rand_mdl + 1 will be the next string after the random string.

I didn't understand what you mean exactly.

Last edited by akcaliberg; 11-22-2013 at 12:45.
akcaliberg is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-22-2013 , 13:56   Re: random_num ArrayGetString
Reply With Quote #3

Here is the function you want :
PHP Code:
pickup_next_ent_model(model[], length)
{
    static 
lastString = -1;

    if( ++
lastString >= ArraySize(g_sPropsModel) )
    {
        
lastString 0;
    }

    
ArrayGetString(g_sPropsModellastStringmodellength);  

And here is how you gonna use it in your code :
PHP Code:
pickup_next_ent_model(szEntModelcharsmax(szEntModel)); 
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-22-2013 at 17:42.
ConnorMcLeod is offline
Gasa
Senior Member
Join Date: Sep 2013
Old 11-22-2013 , 14:50   Re: random_num ArrayGetString
Reply With Quote #4

thanks a lot working great just spaming this errors idk how to fix, and i saw somthing now this error only start spaming when i get to last model and then come first model again. here is logs

Thx Connor again this working great, and i solved error!

if( ++lastString > ArraySize(g_sPropsModel) )
to
if( ++lastString >= ArraySize(g_sPropsModel) )
PHP Code:
L 11/22/2013 20:48:53: [AMXXDisplaying debug trace (plugin "cs_prop_hunt.amxx")
L 11/22/2013 20:48:53: [AMXXRun time error 10native error (native "ArrayGetString")
L 11/22/2013 20:48:53: [AMXX]    [0cs_prop_hunt.sma::pickup_next_ent_model (line 513)
L 11/22/2013 20:48:53: [AMXX]    [1cs_prop_hunt.sma::fwd_CmdStart (line 536)
L 11/22/2013 20:48:55Invalid cellvector handle provided (1:5:5)
L 11/22/2013 20:48:55: [AMXXDisplaying debug trace (plugin "cs_prop_hunt.amxx")
L 11/22/2013 20:48:55: [AMXXRun time error 10native error (native "ArrayGetString")
L 11/22/2013 20:48:55: [AMXX]    [0cs_prop_hunt.sma::pickup_next_ent_model (line 513)
L 11/22/2013 20:48:55: [AMXX]    [1cs_prop_hunt.sma::fwd_CmdStart (line 536)
L 11/22/2013 20:48:56Invalid cellvector handle provided (1:5:5)
L 11/22/2013 20:48:56: [AMXXDisplaying debug trace (plugin "cs_prop_hunt.amxx")
L 11/22/2013 20:48:56: [AMXXRun time error 10native error (native "ArrayGetString")
L 11/22/2013 20:48:56: [AMXX]    [0cs_prop_hunt.sma::pickup_next_ent_model (line 513)
L 11/22/2013 20:48:56: [AMXX]    [1cs_prop_hunt.sma::fwd_CmdStart (line 536

Last edited by Gasa; 11-22-2013 at 15:53. Reason: solved
Gasa is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-22-2013 , 17:43   Re: random_num ArrayGetString
Reply With Quote #5

Sure, i've fixed it in previous post.

I'm affraid when i see you are using this code in CmdStart hook oO
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Gasa
Senior Member
Join Date: Sep 2013
Old 11-22-2013 , 18:29   Re: random_num ArrayGetString
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
Sure, i've fixed it in previous post.

I'm affraid when i see you are using this code in CmdStart hook oO
Exactly and THANKS A LOT
Gasa is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode