[HELP]Recreating object -
Davi52 - 05.12.2018
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.
Re: [HELP]Recreating object -
Kaliber - 05.12.2018
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(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);
}
stock LoadRObjects()
{
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);
}
forward csere();
public csere(){
if(!szin){
szin=1;
for(new i; i<8; i++) DestroyObject(kobject[i]);
LoadRObjects();
}
else if (szin){
szin=0;
for(new i; i<8; i++) DestroyObject(robject[i]);
LoadKObjects();
}
}