complicated problem

Started by (vG)DesTroYeR^, Jan 17, 2025, 05:09 PM

Previous topic - Next topic

(vG)DesTroYeR^

Main.nut(onScriptLoad())
/* Classes */
    class1 <- null;
    class2 <- null;
    class3 <- null;
    class4 <- null;
class1 = AddClass( 5, RGB( 255,0,0 ), Rskin1, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
class2 = AddClass( 5, RGB( 255,0,0 ), Rskin2, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
AddClass( 1, RGB( 248,252,0 ), 64, Vector( -352.5360,-272.5328,10.3614 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
class3 = AddClass( 4, RGB( 0,100,255 ), Bskin1, Vector( -904.543,390.005,11.1784 ), -1.65586, 0, 0 ,0, 0, 0, 0 );
class4 = AddClass( 4, RGB( 0,100,255 ), Bskin2, Vector( -904.543,390.005,11.1784 ), -1.65586, 0, 0 ,0, 0, 0, 0 );
/* Arrays */
Teams.nut
function SetSpawnSkins(Skin1, Skin2, p) {
if(!RoundActive) return SetSpawnSkinsToDefault();
if(!Swapped) {
if(class3 = AddClass( 4, RGB( 0,100,255 ), Bskin1, Vector( -904.543,390.005,11.1784 ), -1.65586, 0, 0 ,0, 0, 0, 0 )) class3.Remove();
if(class4 = AddClass( 4, RGB( 0,100,255 ), Bskin2, Vector( -904.543,390.005,11.1784 ), -1.65586, 0, 0 ,0, 0, 0, 0 )) class4.Remove();
Bskin1 = Skin1;
Bskin2 = Skin2;
if(!stats[ p.ID ].Attack) p.Skin = Bskin1;
else p.Skin = Rskin1;
class3 = AddClass( 4, RGB( 0,100,255 ), Bskin1, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
class4 = AddClass( 4, RGB( 0,100,255 ), Bskin1, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
}
else {
if(class1 = AddClass( 5, RGB( 255,0,0 ), Rskin1, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 )) class1.Remove();
if(class2 = AddClass( 5, RGB( 255,0,0 ), Rskin2, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 )) class2.Remove();
Rskin1 = Skin1;
Rskin2 = Skin2;
if(!stats[ p.ID ].Attack) p.Skin = Rskin1;
else p.Skin = Bskin1;
class1 = AddClass( 5, RGB( 255,0,0 ), Rskin1, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 )
class2 = AddClass( 5, RGB( 255,0,0 ), Rskin2, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 )
}
print("works SetSpawnSkins();");
}
function SetSpawnSkinsToDefault() {
if(class1 = AddClass( 5, RGB( 255,0,0 ), Rskin1, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 )) class1.Remove();
if(class2 = AddClass( 5, RGB( 255,0,0 ), Rskin2, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 )) class2.Remove();
if(class3 = AddClass( 4, RGB( 70,145,255 ), Bskin1, Vector( -904.543,390.005,11.1784 ), -1.65586, 0, 0 ,0, 0, 0, 0 )) class3.Remove();
if(class4 = AddClass( 4, RGB( 70,145,255 ), Bskin2, Vector( -904.543,390.005,11.1784 ), -1.65586, 0, 0 ,0, 0, 0, 0 )) class4.Remove();
class1 = AddClass( 0, RGB( 255,0,0 ), 28, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
class2 = AddClass( 0, RGB( 255,0,0 ), 47, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
class3 = AddClass( 1, RGB( 0,100,255 ), 100, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
class4 = AddClass( 1, RGB( 0,100,255 ), 74, Vector( -828.192,381.562,11.2631 ), 1.46967, 0, 0 ,0, 0, 0, 0 );
}
BasesPreparation.nut
function BaseZones() {
for(local i = 0; i <= GetMaxPlayers(); i++)
{
local p = FindPlayer(i);
if(p)
{
local vector, vector3;
    if (RoundActive) {
        switch (CurrentBaseID) {
            case 1: // Phils
            {
.........
.......
SetSpawnSkins(113, 130, p);
}
StartRound() {
......
...
BaseZones(); // now base zones gonna call SetSpawnSkins();
}


NOTE (1): All code is fine, but the SetSpawnSkinsToDefault(); doesnt even remove the newly added skins, it will endlessly keep creating skin classes as long as the func is being called

NOTE (2): It doesn't delete the class, but it creates another one(so Remove func doesnt do anything, and by calling func it will create skins without deleting old ones

NOTE (3): .Delete(); is useless just like .Remove();. and .Destroy(); is used to hide markers or client side GUIs, so I tested all of them without getting a valid result