Thread: Storing Flags
View Single Post
  #2  
Old 03-29-2009, 02:24 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
You can create an object on the player object :]

PHP Code:
function onCreated() {
  
this.item_Knife = {
    {
"damage"3},
    {
"displayname""Knife"}, 
    {
"weight", {0.150.04}}
  };
  
this.item_Gun = {
    {
"damage"6},
    {
"displayname""Gun"}, 
    {
"weight", {0.60.1}}
  };
}
function 
getItems(items) {
  if (
items.type() != 3) {
    return 
this.(@ "item_"items);
  }
  else {
    
temp.out 0;
    for (
temp.item items) {
      
temp.itemdata this.(@ "item_"temp.item);
      if (
temp.itemdata.size() > 1) {
        
temp.out.add(temp.item);
        
temp.out.add(temp.itemdata);
      }
    }
  }
}
function 
onActionServerside() {
  if (
params[0] == "syncitems") {
    
// get all the player's items here
    
temp.items getItems({"Knife""Gun"});

    
triggerclient("gui""syncitems"temp.items);
  }
}
//#CLIENTSIDE
function onCreated() {
  
player.items = new TStaticVar("Items");
  
triggerserver("gui"this.name"syncitems");
}

function 
onActionClientside() {
  if (
params[0] == "syncitems") {
    
temp.size params[1].size();
    for(
temp.0size+= 2;) {
      
Items.(@ params[1][i]) = params[1][i+1];
    }
  }

I haven't tested it, but it can give you a basic idea of what I meant.
__________________
Reply With Quote