Help is needed with object creation.
#1

Hello everyone, I was wondering what am I doing wrong in this script:

pawn Code:
new Object;

OnGameModeInit
{
   Object = CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50);

}

COMMAND:test1(playerid)
{
   CreateObject(Object); // LINE 2191
}
Errors returned:

Code:
bare.pwn(2191) : warning 202: number of arguments does not match definition
bare.pwn(2191) : warning 202: number of arguments does not match definition
bare.pwn(2191) : warning 202: number of arguments does not match definition
bare.pwn(2191) : warning 202: number of arguments does not match definition
bare.pwn(2191) : warning 202: number of arguments does not match definition
bare.pwn(2191) : warning 202: number of arguments does not match definition
I would really appreciate any help.
Reply
#2

it should be like this -
pawn Code:
new Object;

public OnGameModeInit()
{
return 1;

}

COMMAND:test1(playerid)
{
   Object = CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50);
   return 1;
}
Reply
#3

Use this one
pawn Code:
public OnGameModeInit()
{
   Object = CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50);
   return 1;

}

COMMAND:test1(playerid)
{
   CreateObject(Object); // LINE 2191
   return 1;
}
Reply
#4

Quote:
Originally Posted by MohanedZzZ
View Post
Use this one
pawn Code:
public OnGameModeInit()
{
   Object = CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50); // LINE 551
   return 1;

}

COMMAND:test1(playerid)
{
   CreateObject(Object); // LINE 2190
   return 1;
}
NOTE:
I have removed
new Object;
from the beginning of the script.

Code:
bare.pwn(551) : warning 204: symbol is assigned a value that is never used: "Object"
bare.pwn(2190) : error 017: undefined symbol "Object"
Reply
#5

Quote:
Originally Posted by Xsyiaris
View Post
Appreciate the quick help man!
._.
Don't use his code that will give the same error...
Use the code given by me in first reply ._.
Reply
#6

Quote:
Originally Posted by BroZeus
View Post
._.
Don't use his code that will give the same error...
Use the code given by me in first reply ._.
pawn Code:
COMMAND:test1(playerid)
{
   Object = CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50); // LINE 2190
   return 1;
}
Code:
bare.pwn(2190) : warning 204: symbol is assigned a value that is never used: "Object"
Reply
#7

If u dont want to delete the object later in your script then use this
pawn Code:
//delete the line "new Object"

public OnGameModeInit()
{
return 1;

}

COMMAND:test1(playerid)
{
   CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50);
   return 1;
}
Reply
#8

Quote:
Originally Posted by BroZeus
View Post
If u dont want to delete the object later in your script then use this
pawn Code:
//delete the line "new Object"

public OnGameModeInit()
{
return 1;

}

COMMAND:test1(playerid)
{
   CreateObject(1564, 436.1663, 122.8601, 540.8948, -25.50000, 22.0000, 0, 50);
   return 1;
}
Amazing! *claps*.
You deserve a reputation point for that.
Reply
#9

Quote:
Originally Posted by BroZeus
View Post
._.
Don't use his code that will give the same error...
Use the code given by me in first reply ._.
He posted the code without
"Return 1;"
and i didn't notice the CreateObject thing.
Thanks though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)