SA-MP Forums Archive
Help is needed with object creation. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help is needed with object creation. (/showthread.php?tid=549382)



Help is needed with object creation. - $Marco$ - 06.12.2014

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.


Re: Help is needed with object creation. - BroZeus - 06.12.2014

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;
}



Re: Help is needed with object creation. - MohanedZzZ - 06.12.2014

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;
}



Re: Help is needed with object creation. - $Marco$ - 06.12.2014

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"



Re: Help is needed with object creation. - BroZeus - 06.12.2014

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 ._.


Re: Help is needed with object creation. - $Marco$ - 06.12.2014

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"



Re: Help is needed with object creation. - BroZeus - 06.12.2014

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;
}



Re: Help is needed with object creation. - $Marco$ - 06.12.2014

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.


Re: Help is needed with object creation. - MohanedZzZ - 06.12.2014

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.