Raised This Month: $ Target: $400
 0% 

Using Multi-Dimensional Arrays with an ID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 12-31-2005 , 19:08   Using Multi-Dimensional Arrays with an ID
Reply With Quote #1

Ok, so I am scripting a hitman plugin, which bascially assigns someone a player to kill, and it stores there id and the target's id in one line.

So would something like this work?

Code:
//in the global declarations new g_hitman[33][33] //in the code g_hitman[id][targetid] //now the ID is assigned by the function, but how would I assign the targetid?

Do you guys understand this? Storing the player's id and his target's id in one multi-dimensional array?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-01-2006 , 01:16   Re: Using Multi-Dimensional Arrays with an ID
Reply With Quote #2

Quote:
Originally Posted by Des12
Ok, so I am scripting a hitman plugin, which bascially assigns someone a player to kill, and it stores there id and the target's id in one line.

So would something like this work?

Code:
//in the global declarations new g_hitman[33][33] //in the code g_hitman[id][targetid] //now the ID is assigned by the function, but how would I assign the targetid?

Do you guys understand this? Storing the player's id and his target's id in one multi-dimensional array?
You don't need a multi-demensional array for this unless your trying to hold another value or something in there.. You can just do this..


new g_hitman[33]

g_hitman[id] = targetid.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Des12
Senior Member
Join Date: Jan 2005
Old 01-01-2006 , 10:59  
Reply With Quote #3

What values can the g_hitman[id] hold? Because I thought the 33 was for the players in the server...no?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-01-2006 , 14:57  
Reply With Quote #4

Quote:
Originally Posted by Des12
What values can the g_hitman[id] hold? Because I thought the 33 was for the players in the server...no?
yes, 33 was for the players. That first set the size of the array. Then you have 0-32. 0 mean for the server and 1-32 is for the players.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Des12
Senior Member
Join Date: Jan 2005
Old 01-01-2006 , 15:40  
Reply With Quote #5

Thank you, but now, when someone dies, it will go to my death_msg function, and how do I check if that person that died was anyone's targetid (as in g_hitman[id] = targetid?

I think I am going to do something like

Code:
//in assigning hitman g_hitman[id] = targetid g_wanted[targetid] = 1

Code:
//when targetid dies if(g_wanted[id] == 1) //code to use g_hitman[id] = targetid, but i dont know how to retrieve //the id, because targetid takes over position of the id :/
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 01-01-2006 , 16:15  
Reply With Quote #6

I think I know what you're trying to do:
Code:
register_event("DeathMsg", "on_death", "a"); // ... new g_wanted[33], g_hitman[33]; public on_death() {   new victim = read_data(2);   new killer = read_data(1);   if(g_wanted[victim] == 1 && g_hitman[victim] == killer)   {     // the victim was wanted and the the person that just killed him was the hitman that was assigned to him     g_wanted[victim] = 0;     g_hitman[victim] = 0;   } }
__________________
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
Des12
Senior Member
Join Date: Jan 2005
Old 01-01-2006 , 16:42  
Reply With Quote #7

Oh I see

Thanks v3x
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 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 15:51.


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