Get save corda
#1

How do i get the random cordds where a player will do like /plantbomb and then it finds players coordnates when he does the command?
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/plantbomb", true))
  {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SendClientMessage(playerid, 0xFFFFFFFF, "Bomb Planted.");
 
    // Do other stuff

    CreateExplosion(x, y, z, 12, 10)
  }
  return 0;
}
Something like that, but if you just copy and paste that it will create an explosion when you type the command so you need to add a timer or something.
Reply
#3

Quote:
Originally Posted by V1ceC1ty
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/plantbomb", true))
  {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SendClientMessage(playerid, 0xFFFFFFFF, "Bomb Planted.");
 
    // Do other stuff

    CreateExplosion(x, y, z, 12, 10)
  }
  return 0;
}
Read the post maybe?

ONTOPIC:

There isn't a really efficient way of getting random co-ordonates. You would firstly need to find a bunch of then in area's then when a player is close enough (Check using IsPlayerInRangeOfPoint) make it say a message "/disarm to disarm the planted bomb".
Reply
#4

No like i want to when you do like /plantbomb the bomb get placed where the helll you did the command.
Reply
#5

heres an airstrike filterscript:

Код:
#include <a_samp>
#define WHITE 0xFEFEFEFF

new Float:x;
new Float:y;
new Float:z;
forward airstriketimer();

public OnFilterScriptInit()
{
  print("\n--------------------------------------");
  print(" Airstrike 6.0v | Created by J.Rascall.");
  print("--------------------------------------\n");
  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/airstrike", true) == 0) {
    GetPlayerPos(playerid, Float:x, Float:y, Float:z);
    SendClientMessage(playerid, WHITE, "You have called an airstrike on your position!");
    SendClientMessage(playerid, WHITE, "Move now, you have 10 seconds.");
    SetTimer("airstriketimer", 10000, false);
    return 1;
  }
  return 0;
}


public airstriketimer()
{
  CreateExplosion(x+random(2), y+random(2), z+random(2), 10, 14.0);
}

public OnFilterScriptExit()
{
  return 1;
}
Reply
#6

Quote:
Originally Posted by Steven82
No like i want to when you do like /plantbomb the bomb get placed where the helll you did the command.
Why in the hell do you always post random things? that are not on topic!!!!
Reply
#7

Random Players I'm guessing...?

pawn Код:
new Random=random(Max_Players);
if(IsPlayerConnected(Random))
{
GetPlayerPos(Random,X,Y,Z);
// Do Whatever Code Here
}
OR... If you want to place the bomb at the feet of the command user then just:

pawn Код:
GetPlayerPos(playerid,X,Y,Z);
Reply
#8

Quote:
Originally Posted by XGh0stz
Random Players I'm guessing...?

pawn Код:
new Random=random(Max_Players);
if(IsPlayerConnected(Random))
{
GetPlayerPos(Random,X,Y,Z);
// Do Whatever Code Here
}
OR... If you want to place the bomb at the feet of the command user then just:

pawn Код:
GetPlayerPos(playerid,X,Y,Z);
Thank you all i have been looking for thanks man.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)