New problem, read inside.
#1

I wanted to create a command /ramp, which would be for admins that could create a ramp lets say 5 feet infront of them. I found a stock that could help me, but I don't exactly know how to implent it. I was hoping one of you elite scripters could help me. The stock:

Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	if (GetPlayerVehicleID(playerid))
	{
	  GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	}
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
}
And I TRIED to implent it.. but I know I failed badly.. please help? Command I tried:
pawn Код:
if (strcmp(cmd, "/ramp", true) == 0)
    {
    if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pAdmin] < 1337)
        {
      new Float:x, Float:y, FLoat:z;
      GetPlayerPos(playerid, x, y, z);
      GetXYInFrontOfPlayer(playerid, x, y, 5.0);
      CreateObject(1655, x, y, z);
                return 1;
            }
        }
    }
Reply
#2

what exactly doesn|t work?


if nutin happends usually it should be because u didn|t create
the users folder in scriptfiles
Reply
#3

No, it sends Server: Unknown Command.
Reply
#4

pawn Код:
if (strcmp(cmd, "/register", true) ==0 )
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerLogged[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
                return 1;
            }
            else
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "users/%s.ini", sendername);
            new File: hFile = fopen(string, io_read);
            if (hFile)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "That username is already taken, please choose a different one.");
                fclose(hFile);
                return 1;
            }
        new tmppass[64];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /register [password]");
                return 1;
            }
            strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
            OnPlayerRegister(playerid,tmppass);
            return 1;
        }
    }
return 1;
}
u returned 1 after the command was closed so it automacially returned 0
Reply
#5

EDIT: Fixed.

Thanks for the help.
Reply
#6

Updated with a new problem..
Reply
#7

the XYZ is returned
so
pawn Код:
new Float:x, Float:y;
GetXYInFrontOfPlayer(playerid,x,y,5.0);
x,y is now the coords 5.0 units in front of that player.

got it?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)