How do i fix this command?
#1

ok i made a command that spawns a wall next to you, but the wall is not in front of you here is the code

code:
Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
		new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
		CreateObject(974,x,y+2,z,0,0,0);
		GivePlayerMoney(playerid,-20000);
		return 1;
	}
Could someone edit it so the wall appears in front of the player please? Thankyou!


~~[Drift]~~
Reply
#2

Quote:
Originally Posted by Drift_04
ok i made a command that spawns a wall next to you, but the wall is not in front of you here is the code

code:
Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
		new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
		CreateObject(974,x,y+2,z,0,0,0);
		GivePlayerMoney(playerid,-20000);
		return 1;
	}
Could someone edit it so the wall appears in front of the player please? Thankyou!


~~[Drift]~~
pawn Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
    {
        if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
        new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
        CreateObject(974,x+2,y,z,0,0,0);
        GivePlayerMoney(playerid,-20000);
        return 1;
    }
+2 y axis will make it next to you. If you do +2 x axis it will go infront of you. Correct me if I'm wrong.
Reply
#3

no ur wrong.
Reply
#4

pawn Код:
if(!strcmp(cmd,"/wall",true))
{
  if(GetPlayerMoney(playerid<=20000) return SendClientMessage(playerid,red,"You need 20,000$");
  new Float:x,Float:y,Float:z;
  GetPlayerPos(playerid,x,y,z);
  CreateObject(974,x,y+2,z,0,0,0);
  return GivePlayerMoney(playerid,-20000);
}
In the first code, /wall doesn't have 10 cells.
Reply
#5

Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by Drift_04
ok i made a command that spawns a wall next to you, but the wall is not in front of you here is the code

code:
Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
		new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
		CreateObject(974,x,y+2,z,0,0,0);
		GivePlayerMoney(playerid,-20000);
		return 1;
	}
Could someone edit it so the wall appears in front of the player please? Thankyou!


~~[Drift]~~
pawn Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
    {
        if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
        new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
        CreateObject(974,x+2,y,z,0,0,0);
        GivePlayerMoney(playerid,-20000);
        return 1;
    }
+2 y axis will make it next to you. If you do +2 x axis it will go infront of you. Correct me if I'm wrong.
lol

Use this

pawn Код:
stock Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
  new Float:a;
  GetPlayerPos(playerid, x, y, a);
  if (IsPlayerInAnyVehicle(playerid))
    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  else
    GetPlayerFacingAngle(playerid, a);
  x += (distance * floatsin(-a, degrees));
  y += (distance * floatcos(-a, degrees));
  return a;
}
Reply
#6

Quote:
Originally Posted by Dujma
Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by Drift_04
ok i made a command that spawns a wall next to you, but the wall is not in front of you here is the code

code:
Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
		new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
		CreateObject(974,x,y+2,z,0,0,0);
		GivePlayerMoney(playerid,-20000);
		return 1;
	}
Could someone edit it so the wall appears in front of the player please? Thankyou!


~~[Drift]~~
pawn Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
    {
        if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
        new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
        CreateObject(974,x+2,y,z,0,0,0);
        GivePlayerMoney(playerid,-20000);
        return 1;
    }
+2 y axis will make it next to you. If you do +2 x axis it will go infront of you. Correct me if I'm wrong.
lol

Use this

pawn Код:
stock Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
  new Float:a;
  GetPlayerPos(playerid, x, y, a);
  if (IsPlayerInAnyVehicle(playerid))
    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  else
    GetPlayerFacingAngle(playerid, a);
  x += (distance * floatsin(-a, degrees));
  y += (distance * floatcos(-a, degrees));
  return a;
}
I just fixed the code. I didn't even read what he wants there..
Reply
#7

Not that just. He said that to create an object in front of you, you need to increase the X axis by 2... lol
Reply
#8

so wherewould i place that code in this??




in here:
Код:
if (strcmp("/wall", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,red, "You need $20,000$");
		new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
		CreateObject(974,x,y+2,z,0,0,0);
		GivePlayerMoney(playerid,-20000);
		return 1;
	}
cuz if i was supposed to place it somewhere in my script it didnt work.
Reply
#9

pawn Код:
if(!strcmp("/wall", cmdtext, true))
    {
        if(GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid, red, "You need $20,000$");
        new Float:Pos[4];
        GetPlayerFacingAngle(playerid, Pos[0]);
        GetPlayerPos(playerid, Pos[1], Pos[2], Pos[3]);
        Pos[1] += floatmul(5.0, floatsin(-Pos[0], degrees));
        Pos[2] += floatmul(5.0, floatcos(-Pos[0], degrees));
        CreateObject(974, Pos[1], Pos[2], Pos[3], 0, 0, 0);
        GivePlayerMoney(playerid, -20000);
        return 1;
    }
Reply
#10

it still doesnt appear in front of me. , thanx or trying everyone.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)