PDA

View Full Version : Object Help


tobi736
31/07/2018, 10:03 AM
i watch wiki sa-mp
i code my own code
this is my code
new object;
public onplayergamemodeinit()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}
cmd:test(playerid, params[])
{
EditObject(playerid, objecthouse);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}
i complie success, but i join game i use and no happened
please help me
my english bad, sorry

JasonRiggs
31/07/2018, 10:33 AM
You made some mistakes..

public OnGameModeInIt()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}
cmd:test(playerid, params[])
{
EditObject(playerid, object);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}

You made the player edit the object called "objecthouse" not "object".. So you should do it like that ^^,
Also you made another mistake.. You created the object under something called "onplayergamemodeinit", That's wrong, You must use OnGameModeInIt.. so the object will spawn... You'll find OnGameModeInIt already there in your script.. just put the line object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); anywhere under it.. and don't forget to put the new object; on top of the script under the includes..

tobi736
31/07/2018, 10:42 AM
i put the Createobject to ongamemodeinit
but won't work

tobi736
31/07/2018, 11:27 AM
i put to the ongamemodeinit
won't work

RJTabish
31/07/2018, 11:52 AM
Put This OnGamemodeinit
public OnGameModeInIt()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}

and then this is kind of define put on the top

new object;

Now Paste this as a separate place not in the ongamemodeinit lol empty place

cmd:test(playerid, params[])
{
EditObject(playerid, object);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}




Look Like This
new object;


public OnGameModeInIt()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}


cmd:test(playerid, params[])
{
EditObject(playerid, object);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}

tobi736
31/07/2018, 02:02 PM
bro, won't work
i put to OnGameModeInit. createobject and i do what your said
but i use /test don't show object

tobi736
05/08/2018, 08:44 AM
Yes,i do all but won't work

GRiMMREAPER
05/08/2018, 08:59 AM
Can you show us your current code?

tobi736
05/08/2018, 09:20 AM
new object
public OnGameModeInIt()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}
cmd:test(playerid, params[])
{
EditObject(playerid, object);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}
This is my code, i compile success but i use cmd /test, nothing show up, just show the cursor

GRiMMREAPER
05/08/2018, 09:28 AM
You wrote "OnGamemodeInIt".

new object;

public OnGameModeInit()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
return 1;
}

cmd:test(playerid, params[])
{
EditObject(playerid, object);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}

tobi736
05/08/2018, 09:30 AM
please help me

tobi736
05/08/2018, 09:32 AM
yes, i change but won't work too, join the game and just show the cursor

GRiMMREAPER
05/08/2018, 09:33 AM
yes, i change but won't work too, join the game and just show the cursor

Are you near the object? Do you see it?

tobi736
05/08/2018, 09:50 AM
no, i don't see anything, i just see the cursor and nothing show up

GRiMMREAPER
05/08/2018, 10:05 AM
no, i don't see anything, i just see the cursor and nothing show up

I suppose that happens because you are not near the object.

new object;

public OnGameModeInit()
{
object = CreateObject(19360, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
return 1;
}


cmd:test(playerid, params[])
{
SetPlayerPos(playerid, 0.0, 0.0, 2.0); // Takes you to the object's position.
EditObject(playerid, object);
SendClientMessageEx(playerid, COLOR_GRAY, "TESTING");
return 1;
}

tobi736
05/08/2018, 10:11 AM
won't work, i add your code and have problem, object don't show up, just show the cursor again and the player teleported

tobi736
05/08/2018, 10:44 AM
please help me

Florin48
05/08/2018, 10:52 AM
try now

CMD:test(playerid, params[])
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
new object = CreateObject(19360, pos[0], pos[1], pos[2], 0.0, 0.0, 0.0);
EditObject(playerid, object);
SendClientMessage(playerid, COLOR_GRAY, "TESTING");
return 1;
}

tobi736
05/08/2018, 11:51 AM
THANKS YOUR <3<3 YOUR ARE THE BEST
but can i createobject next to the player?

tobi736
05/08/2018, 11:53 AM
and how save the object?
i turn off the samp-server, turn on again, login to the server the object is disappear

Florin48
05/08/2018, 12:14 PM
THANKS YOUR <3<3 YOUR ARE THE BEST
but can i createobject next to the player?

use CreatePlayerObject
for edit use EditPlayerObject
and http://wiki.sa-mp.com/wiki/CreatePlayerObject
here you find everything you need, below you have all the features that will help you.