SA-MP Forums Archive
more gates - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: more gates (/showthread.php?tid=182244)



more gates - pleiter - 09.10.2010

i whanted to make 2 gates but first i maked 1 but then i wanted to add in the second 1 but that wont work pleas help me

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/open1", true) == 0)
{
MoveObject(Gate, 249.687729, 433.796722, 0.0898772, 3.00);
SendClientMessage(playerid, 0x00ff00, "Gate Down");
return 1;
}
if(strcmp(cmdtext, "/close1", true) == 0)
{
MoveObject(Gate, 249.692200, 433.822876, 57.365799, 3.00);
SendClientMessage(playerid, 0x00ff00, "Gate Up");
return 1;
}
if(strcmp(cmdtext, "/open2", true) == 0)
{
MoveObject(Gate, 18450, 277.404968, 369.266449, 3.00);
SendClientMessage(playerid, 0x00ff00, "Roof Open");
return 1;
}
if(strcmp(cmdtext, "/close2", true) == 0)
{
MoveObject(Gate, 18450, 277.404968, 369.266449, 3.00);
SendClientMessage(playerid, 0x00ff00, "Roof Closed");
}

i know open and closed are still the same


Re: more gates - WillyP - 09.10.2010

MoveObject(gate,codehere);

they are all the same.

make different objects and different names


Re: more gates - Backwardsman97 - 09.10.2010

You're using the same variable 'Gate' for both commands. You will need to create an object for your second gate and store it's object id in it's own variable such as 'Gate2' or whatever you want.


Re: more gates - pleiter - 09.10.2010

thx problem solved

but i got a new problem my 2nd gate moves away to nowhere not to the place in the script

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/xsd", true) == 0)
{
MoveObject(Gate, 249.687729, 433.796722, 0.0898772, 3.00);
SendClientMessage(playerid, 0x00ff00, "Gate Down");
return 1;
}
if(strcmp(cmdtext, "/xsu", true) == 0)
{
MoveObject(Gate, 249.692200, 433.822876, 57.365799, 3.00);
SendClientMessage(playerid, 0x00ff00, "Gate Up");
return 1;
}
if(strcmp(cmdtext, "/xsro", true) == 0)
{
MoveObject(Roof, 18450, 283.639709, 354.576416, 3.00);
SendClientMessage(playerid, 0x00ff00, "Roof Open");
return 1;
}
if(strcmp(cmdtext, "/xsrc", true) == 0)
{
MoveObject(Roof, 18450, 277.404968, 369.266449, 3.00);
SendClientMessage(playerid, 0x00ff00, "Roof Closed");
return 1;
}
return 0;
}


Re: more gates - pleiter - 10.10.2010

pleas help me