[HELP]Recreating object
#1

Hey, I want to switch te neontube colors, but my code doesnt work, whats wrong with it? Thank you !

Код:
new kobject[8];
new robject[8];
public OnGameModeInit()
{
	kobject[0] = CreateObject(18648, 1942.1256, -2670.8657, 19.3619, 90.0000, 0.0000, 0.0000); 
	kobject[1] = CreateObject(18648, 1943.7292, -2671.9145, 18.1930, 90.0000, 0.0000, 0.0000); 
	kobject[2] = CreateObject(18648, 1935.0146, -2691.6123, 19.2667, 0.0000, 0.0000, 0.0000); 
	kobject[3] = CreateObject(18648, 1933.1440, -2691.9433, 20.4428, 0.0000, 0.0000, 0.0000); 
	kobject[4] = CreateObject(18648, 1934.9956, -2680.3747, 19.2133, 0.0000, 0.0000, 0.0000); 
	kobject[5] = CreateObject(18648, 1952.2093, -2685.6462, 27.9337, 0.0000, 0.0000, 90.0000);
	kobject[6] = CreateObject(18648, 1954.0262, -2677.5134, 19.7325, 0.0000, 0.0000, 90.0000);
	kobject[7] = CreateObject(18648, 1949.2596, -2677.5581, 19.7213, 0.0000, 0.0000, 90.0000);
	robject[0] = CreateObject(18647, 1942.1256, -2670.8657, 19.3619, 90.0000, 0.0000, 0.0000); 
	robject[1] = CreateObject(18647, 1943.7292, -2671.9145, 18.1930, 90.0000, 0.0000, 0.0000); 
	robject[2] = CreateObject(18647, 1935.0146, -2691.6123, 19.2667, 0.0000, 0.0000, 0.0000); 
	robject[3] = CreateObject(18647, 1933.1440, -2691.9433, 20.4428, 0.0000, 0.0000, 0.0000);
	robject[4] = CreateObject(18647, 1934.9956, -2680.3747, 19.2133, 0.0000, 0.0000, 0.0000); 
	robject[5] = CreateObject(18647, 1952.2093, -2685.6462, 27.9337, 0.0000, 0.0000, 90.0000); 
	robject[6] = CreateObject(18647, 1954.0262, -2677.5134, 19.7325, 0.0000, 0.0000, 90.0000); 
	robject[7] = CreateObject(18647, 1949.2596, -2677.5581, 19.7213, 0.0000, 0.0000, 90.0000); 
	return 1;
}
forward csere();
public csere(){
	if(!szin){
		szin=1;
		for(new i=0;i<8;i++){
                      DestroyObject(kobject[i]);
                      CreateObject(robject[i];)
               }
	}
	else if (szin){
		szin=0;
		for(new i=0;i<8;i++)
		{
			DestroyObject(robject[i]);
			CreateObject(kobject[i]);
		}
	}
}
It gives me 7 warning at both of the CreateObject lines in the for cycle.
Reply
#2

You should split the code like this:

PHP код:
new kobject[8];
new 
robject[8];
public 
OnGameModeInit()
{
    
LoadKObjects();
    
LoadRObjects();
    return 
1;
}
stock LoadKObjects()
{
    
kobject[0] = CreateObject(186481942.1256, -2670.865719.361990.00000.00000.0000); 
    
kobject[1] = CreateObject(186481943.7292, -2671.914518.193090.00000.00000.0000); 
    
kobject[2] = CreateObject(186481935.0146, -2691.612319.26670.00000.00000.0000); 
    
kobject[3] = CreateObject(186481933.1440, -2691.943320.44280.00000.00000.0000); 
    
kobject[4] = CreateObject(186481934.9956, -2680.374719.21330.00000.00000.0000); 
    
kobject[5] = CreateObject(186481952.2093, -2685.646227.93370.00000.000090.0000);
    
kobject[6] = CreateObject(186481954.0262, -2677.513419.73250.00000.000090.0000);
    
kobject[7] = CreateObject(186481949.2596, -2677.558119.72130.00000.000090.0000);
}
stock LoadRObjects()
{
    
robject[0] = CreateObject(186471942.1256, -2670.865719.361990.00000.00000.0000); 
    
robject[1] = CreateObject(186471943.7292, -2671.914518.193090.00000.00000.0000); 
    
robject[2] = CreateObject(186471935.0146, -2691.612319.26670.00000.00000.0000); 
    
robject[3] = CreateObject(186471933.1440, -2691.943320.44280.00000.00000.0000);
    
robject[4] = CreateObject(186471934.9956, -2680.374719.21330.00000.00000.0000); 
    
robject[5] = CreateObject(186471952.2093, -2685.646227.93370.00000.000090.0000); 
    
robject[6] = CreateObject(186471954.0262, -2677.513419.73250.00000.000090.0000); 
    
robject[7] = CreateObject(186471949.2596, -2677.558119.72130.00000.000090.0000); 
}
forward csere();
public 
csere(){
    if(!
szin){
        
szin=1;
        for(new 
ii<8i++) DestroyObject(kobject[i]);
        
LoadRObjects();
    }
    else if (
szin){
        
szin=0;
        for(new 
ii<8i++) DestroyObject(robject[i]);
        
LoadKObjects();
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)