Moczulak
3rd February 2013, 10:34
Hey all :)
I wrote a script that handles the array. The script only works on the last table, in my case I have 3 tables, and only the last one works as it should :(
Tables:
level.weapons = [];
level.weapons[0] = spawnStruct();
level.weapons[0].weapon = "thompson_mp";
level.weapons[0].numberimage = "1";
level.weapons[1] = spawnStruct();
level.weapons[1].weapon = "kar98k_mp";
level.weapons[1].numberimage = "2";
level.weapons[2] = spawnStruct();
level.weapons[2].weapon = "m1carbine_mp";
level.weapons[2].numberimage = "3";
Script:
if(response == "buttons")
{
for(i = 0; i < level.weapons.size; i++)
{
guid = self getGuid();
self thread files\_propertiesguid::load(guid); // Load self.oldweapon
if(self.oldweapon == level.weapons[i].weapon)
{
self setClientCvar(weaponButton, "3");
self setClientCvar(weaponImage, level.weapons[i].numberimage);
}
else
{
self setClientCvar(weaponButton, "2");
self setClientCvar(weaponImage, "0");
}
}
}
Last table, which is the third "m1carbine_mp" is working correctly, but the first two spoil the script ...
The first two arrays bad work on the script, if they read the script uses the "if" and "else" at the same time :(
Please Help me..
I wrote a script that handles the array. The script only works on the last table, in my case I have 3 tables, and only the last one works as it should :(
Tables:
level.weapons = [];
level.weapons[0] = spawnStruct();
level.weapons[0].weapon = "thompson_mp";
level.weapons[0].numberimage = "1";
level.weapons[1] = spawnStruct();
level.weapons[1].weapon = "kar98k_mp";
level.weapons[1].numberimage = "2";
level.weapons[2] = spawnStruct();
level.weapons[2].weapon = "m1carbine_mp";
level.weapons[2].numberimage = "3";
Script:
if(response == "buttons")
{
for(i = 0; i < level.weapons.size; i++)
{
guid = self getGuid();
self thread files\_propertiesguid::load(guid); // Load self.oldweapon
if(self.oldweapon == level.weapons[i].weapon)
{
self setClientCvar(weaponButton, "3");
self setClientCvar(weaponImage, level.weapons[i].numberimage);
}
else
{
self setClientCvar(weaponButton, "2");
self setClientCvar(weaponImage, "0");
}
}
}
Last table, which is the third "m1carbine_mp" is working correctly, but the first two spoil the script ...
The first two arrays bad work on the script, if they read the script uses the "if" and "else" at the same time :(
Please Help me..