Raised This Month: $ Target: $400
 0% 

Array Help


Post New Thread Reply   
 
Thread Tools Display Modes
cheshire-
Junior Member
Join Date: Jul 2005
Old 12-03-2005 , 11:30  
Reply With Quote #11

Quote:
Originally Posted by v3x
Code:
new i = random_num(0, MaxModels-1) cs_set_user_team(victim_id, CS_TEAM_CT, CTModels[i])
?
This is one of the many things I tried, but it gave me an argument type mismatch on argument 3...
__________________
cheshire- is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-03-2005 , 11:32  
Reply With Quote #12

Quote:
Originally Posted by Hawk552
Code:
        new i = random_num(1,9),team = random_num(1,2)         cs_set_user_team(victim_id,team,i) // error exists on this line

?
You don't seem to understand a define is basically a variable that's number doesn't change. In this case, CS_CT_URBAN and everything else is simply a number. Look:

Code:
enum CsInternalModel {     CS_DONTCHANGE = 0,     CS_CT_URBAN = 1,     CS_T_TERROR = 2,     CS_T_LEET = 3,     CS_T_ARCTIC = 4,     CS_CT_GSG9 = 5,     CS_CT_GIGN = 6,     CS_CT_SAS = 7,     CS_T_GUERILLA = 8,     CS_CT_VIP = 9 };
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-03-2005 , 11:34  
Reply With Quote #13

Code:
new i = random_num(0, MaxModels-1) cs_set_user_team(victim_id, CS_TEAM_CT, CTModels[i])
Then do:
Code:
new CTModels[MaxModels] = { CS_CT_URBAN, CS_CT_GSG9, CS_CT_GIGN, CS_CT_SAS }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-03-2005 , 12:53  
Reply With Quote #14

Quote:
Originally Posted by Hawk552
CS_CT_URBAN and everything else is simply a number.
Yes and no. It depend on one detail.
If you mean (CS_CT_URBAN == 1) you are wrong.
VEN is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-03-2005 , 13:01  
Reply With Quote #15

Hawk, while they are represented by a number, they also have a special type (CsInternalModel). Just like Floats are really only numbers, they have a whole set of special things about them, as they are their own type. However, this will work just fine:

Code:
new CTModels[MaxModels] = { 1, 5, 6, 7 }  new i = random_num(0, MaxModels-1) cs_set_user_team(victim_id, CS_TEAM_CT, CsInternalModel:CTModels[i])

This is v3x's code, only the array contains integers instead of CsInternalModels, and the type CsInternalModel precedes the random number we drew.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-03-2005 , 13:20  
Reply With Quote #16

Ah, I didn't know that. I guess I was half right.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
cheshire-
Junior Member
Join Date: Jul 2005
Old 12-03-2005 , 14:59  
Reply With Quote #17

Quote:
Originally Posted by XxAvalanchexX
Hawk, while they are represented by a number, they also have a special type (CsInternalModel). Just like Floats are really only numbers, they have a whole set of special things about them, as they are their own type. However, this will work just fine:

Code:
new CTModels[MaxModels] = { 1, 5, 6, 7 }  new i = random_num(0, MaxModels-1) cs_set_user_team(victim_id, CS_TEAM_CT, CsInternalModel:CTModels[i])

This is v3x's code, only the array contains integers instead of CsInternalModels, and the type CsInternalModel precedes the random number we drew.
It still gives me an argument type mismatch...
__________________
cheshire- is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-03-2005 , 15:36  
Reply With Quote #18

"It still gives me an argument type mismatch..."

That is an absolutely worthless piece of information unless you can tell us which line has the mismatch.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-04-2005 , 10:09  
Reply With Quote #19

Post the whole code that you are try to compile.
VEN 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 08:08.


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