CreateDynamicObject
#1

I'm trying to create an furniture system for my gamemode, but the object won't create or load

Код:
Objekt[o][Ob] = CreateDynamicObject(Objekt[o][Model], Objekt[o][PositsionX], Objekt[o][PositsionY], Objekt[o][PositsionZ],IG[playerid][PVW],IG[playerid][PINT],100.0);
Reply
#2

I'll pay whoever helps me
Reply
#3

You have to be in the same virtual world and interior.
Reply
#4

I am
Reply
#5

PHP код:
new Objekt[o][Ob]; 
Reply
#6

Yep, got it already, pawn compiles it with no errors.
Reply
#7

Show me your system
Reply
#8

Код:
func LisaObjekt(playerid)
{
    for(new o = 1; o <= MAX_OBJEKTE; o++)
    {
	    if(Objekt[o][Mudel] == 0)
	    {
	        Objekt[o][VW] = IG[playerid][PVW];
	        Objekt[o][Int] = IG[playerid][PINT];
	        Objekt[o][PositsionX] = IG[playerid][PosX];
	        Objekt[o][PositsionZ] = IG[playerid][PosY];
	        Objekt[o][PositsionY] = IG[playerid][PosZ];
	        Objekt[o][Mudel] = IG[playerid][Mudel];
	        Objekt[o][PositsionRX] = 0;
	        Objekt[o][PositsionRY] = 0;
	        Objekt[o][PositsionRZ] = 0;
		Objekt[o][Ob] = CreateDynamicObject(Objekt[o][Mudel], Objekt[o][PositsionX], Objekt[o][PositsionY], Objekt[o][PositsionZ],IG[playerid][PVW],IG[playerid][PINT],100.0);
                EditDynamicObject(playerid, Objekt[o][Ob]);
		GameTextForPlayer(playerid, "~g~Objekt lisatud", 5000, 1);
		return 1;
	    }
	}
	return 1;
}
Reply
#9

Quote:
Originally Posted by facemelt0r
Посмотреть сообщение
Код:
func LisaObjekt(playerid)
{
    for(new o = 1; o <= MAX_OBJEKTE; o++)
    {
	    if(Objekt[o][Mudel] == 0)
	    {
	        Objekt[o][VW] = IG[playerid][PVW];
	        Objekt[o][Int] = IG[playerid][PINT];
	        Objekt[o][PositsionX] = IG[playerid][PosX];
	        Objekt[o][PositsionZ] = IG[playerid][PosY];
	        Objekt[o][PositsionY] = IG[playerid][PosZ];
	        Objekt[o][Mudel] = IG[playerid][Mudel];
	        Objekt[o][PositsionRX] = 0;
	        Objekt[o][PositsionRY] = 0;
	        Objekt[o][PositsionRZ] = 0;
		Objekt[o][Ob] = CreateDynamicObject(Objekt[o][Mudel], Objekt[o][PositsionX], Objekt[o][PositsionY], Objekt[o][PositsionZ],IG[playerid][PVW],IG[playerid][PINT],100.0);
                EditDynamicObject(playerid, Objekt[o][Ob]);
		GameTextForPlayer(playerid, "~g~Objekt lisatud", 5000, 1);
		return 1;
	    }
	}
	return 1;
}
Will probably produce a runtime error.

The indexes of arrays work like follows:

If you have an array of the size 10, you must access it from 0 to 9, not 1 to 10.

Your loop starts at 1, and runs until the size of the array (which is 1 too high).

Change the loop to:

Код:
for(new o = 0; o < MAX_OBJEKTE; o++)
Quote:
Originally Posted by Loinal
Посмотреть сообщение
PHP код:
new Objekt[o][Ob]; 
You are trying to help, but please think a bit more before replying. He didn't say anything about compiler errors, also your code would not work at all either.
Reply
#10

Quote:
Originally Posted by NaS
Посмотреть сообщение
Will probably produce a runtime error.

The indexes of arrays work like follows:

If you have an array of the size 10, you must access it from 0 to 9, not 1 to 10.

Your loop starts at 1, and runs until the size of the array (which is 1 too high).

Change the loop to:

Код:
for(new o = 0; o < MAX_OBJEKTE; o++)

You are trying to help, but please think a bit more before replying. He didn't say anything about compiler errors, also your code would not work at all either.
unfortunately it still didn't work. I think the problem is in the vw and int cause i tried it in int 0 and vw 0, then it worked...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)