13.01.2008, 06:43
Question 1:
I wrote a script that takes a ship (an object) on a sail from one point to another,
and when the ship reaches the second point it changes its rotation (takes a turn).
The problem is that when the ship reaches point 2 it doesn’t rotate!! just staying put!!
The script is using a while loop to always check if the current position of the ship equals to the destination point.
pls pls tell me what’s wrong with the script, I’m sorry but i just started with scripting (I tried reading some guides). Here is the script:
new ship;
new Float;
new Float:y;
new Float:z;
new n=0;
public OnGameModeInit()
{
ship = CreateObject(8493, 1957.874756, 541.984558, 17.617411, 0.0000, 0.0000, 266.3215);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/start sail", true)==0)
{
MoveObject(ship,2163.3489,487.2763,17.617411,25);
while (n == 0)
{
GetObjectPos(ship, x, y, z);
if ((x==2163.3489) && (y==487.2763) && (z==17.617411))
{
n = 1;
}
}
SetObjectRot(ship, 0, 30, 0);
return 1;
}
return 0;
}
Question 2:
How can i limit a command (for example - a teleport) so that only admins can use it?
Thank u!!
Its my first post on this forum so i hope it's in it's right place :/
I wrote a script that takes a ship (an object) on a sail from one point to another,
and when the ship reaches the second point it changes its rotation (takes a turn).
The problem is that when the ship reaches point 2 it doesn’t rotate!! just staying put!!
The script is using a while loop to always check if the current position of the ship equals to the destination point.
pls pls tell me what’s wrong with the script, I’m sorry but i just started with scripting (I tried reading some guides). Here is the script:
new ship;
new Float;
new Float:y;
new Float:z;
new n=0;
public OnGameModeInit()
{
ship = CreateObject(8493, 1957.874756, 541.984558, 17.617411, 0.0000, 0.0000, 266.3215);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/start sail", true)==0)
{
MoveObject(ship,2163.3489,487.2763,17.617411,25);
while (n == 0)
{
GetObjectPos(ship, x, y, z);
if ((x==2163.3489) && (y==487.2763) && (z==17.617411))
{
n = 1;
}
}
SetObjectRot(ship, 0, 30, 0);
return 1;
}
return 0;
}
Question 2:
How can i limit a command (for example - a teleport) so that only admins can use it?
Thank u!!
Its my first post on this forum so i hope it's in it's right place :/