Creating object problem
#1

Hello, I have problem with creating dynamic object

On top of script
Код:
new grass;
OnGameModeInit:

Код:
grass = CreateDynamicObject(702, -30.87103, 2166.84399, 20.48755, 0.00000, 0.00000, 0.00000);
OnPlayerConnect:

Код:
SetTimerEx("registerProcess1", 300, false, "i", playerid);
Here is code for moving object:
Код:
public registerProcess1(playerid) {
	setLoginCamera(playerid);
	MoveDynamicObject(grass, -33.18955, 2169.11890, 21.39942, 3.0);
	SetTimerEx("registerProcess2", 3000, false, "i", playerid);
	return 1;
}
public registerProcess2(playerid) {
    MoveDynamicObject(grass, -36.98371, 2172.54614, 21.27884, 3.0);
	SetTimerEx("registerProcess3", 3000, false, "i", playerid);
	return 1;
}
public registerProcess3(playerid) {
    MoveDynamicObject(grass, -40.13485, 2175.59448, 22.30098, 3.0);
	SetTimerEx("registerProcess4", 3000, false, "i", playerid);
	return 1;
}
public registerProcess4(playerid) {
    MoveDynamicObject(grass, -44.45544, 2179.66577, 22.30098, 3.0);
	SetTimerEx("registerProcess5", 100, false, "i", playerid);
	return 1;
}
public registerProcess5(playerid) {
	DestroyDynamicObject(grass);
	if(fexist(UserPath(playerid)))
	{
		// code
	}
	else
	{
 	// code
	}
	return 1;
}
Reply
#2

Try this:
pawn Код:
new grass[MAX_PLAYERS];
OnGameModeInit:
grass[playerid] = CreateDynamicObject(702, -30.87103, 2166.84399, 20.48755, 0.00000, 0.00000, 0.00000);

OnPlayerConnect:
SetTimerEx("registerProcess1", 300, false, "i", playerid);

public registerProcess1(playerid) {
    setLoginCamera(playerid);
    MoveDynamicObject(grass[playerid], -33.18955, 2169.11890, 21.39942, 3.0);
    SetTimerEx("registerProcess2", 3000, false, "i", playerid);
    return 1;
}
public registerProcess2(playerid) {
    MoveDynamicObject(grass[playerid], -36.98371, 2172.54614, 21.27884, 3.0);
    SetTimerEx("registerProcess3", 3000, false, "i", playerid);
    return 1;
}
public registerProcess3(playerid) {
    MoveDynamicObject(grass[playerid], -40.13485, 2175.59448, 22.30098, 3.0);
    SetTimerEx("registerProcess4", 3000, false, "i", playerid);
    return 1;
}
public registerProcess4(playerid) {
    MoveDynamicObject(grass[playerid], -44.45544, 2179.66577, 22.30098, 3.0);
    SetTimerEx("registerProcess5", 100, false, "i", playerid);
    return 1;
}
public registerProcess5(playerid) {
    DestroyDynamicObject(grass[playerid]);
    if(fexist(UserPath(playerid)))
    {
        // code
    }
    else
    {
    // code
    }
    return 1;
}
Reply
#3

Not working and playerid can't be used under OnGameModeInit (can with loop), I used in OnPlayerConnect
Reply
#4

PHP код:
new Process[MAX_PLAYERS]; //top of the script
public OnPlayerConnect(playerid) {
Process[playerid] = 0;
SetTimerEx("registerProcess"300false"i"playerid);
return 
1;
}
public 
registerProcess(playerid) {
    switch(
Process[playerid]) {
        case 
0: {
             
setLoginCamera(playerid);
            
MoveDynamicObject(grass, -33.189552169.1189021.399423.0);
            
SetTimerEx("registerProcess"3000false"i"playerid);
            
Process[playerid] += 1;
        }
        case 
1:
              
MoveDynamicObject(grass, -36.983712172.5461421.278843.0);
            
SetTimerEx("registerProcess"3000false"i"playerid);
            
Process[playerid] += 1;
        }
        case 
2: {
            
MoveDynamicObject(grass, -40.134852175.5944822.300983.0);
            
SetTimerEx("registerProcess"3000false"i"playerid);
            
Process[playerid] += 1;
        }
        case 
3: {
            
MoveDynamicObject(grass, -44.455442179.6657722.300983.0);
            
SetTimerEx("registerProcess"100false"i"playerid);
            
Process[playerid] += 1;
        }
        case 
4: {
            
DestroyDynamicObject(grass);
            if(
fexist(UserPath(playerid)))
            {
                
// code
            
}
            else
            {
             
// code
            
}
        }
    }
    return 
true;

Reply
#5

Move it from OnGameModeInit to OnPlayerConnect
Reply
#6

Ok issue is fixed if CreateObjcet is used, I want to create per player object and I use function CreatePlayerObject, but it doesen't create object, any clue why is this happening?
Reply
#7

Quote:

CreaPlayerObject(playerid, modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, FloatrawDistance = 0.0);

follow this style of object create it would work
Reply
#8

Quote:
Originally Posted by jlalt
Посмотреть сообщение
follow this style of object create it would work
Not working, and I also noticed that objects created with CreateDynamicObject won't create, only CreateObject works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)