SA-MP Forums Archive
How do i suppose to do it? - 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)
+--- Thread: How do i suppose to do it? (/showthread.php?tid=546876)



How do i suppose to do it? - Glossy42O - 18.11.2014

Aye people.

I got little prob

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(
IsPlayerInCheckpoint(playerid))
  {
     if(
GetPlayerPos(playerid296.5538,-38.1188,1001.5156) return SendClientMessage(playerid, -1"You are not in the weaponshop.");
     
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Choose your weapon""Deagle\nShotgun\nSniper\nM4\nMP5\nCombat\nGrenade\nTec9""Purchase""Exit");
  }
  
SetPlayerPos(playerid286.9429,-37.3731,1001.5156);
  
SendClientMessage(playerid, -1"You have entered the weapon shop");
  return 
1;

How could i make if player types /weaponshop it will say him "You are not in the weapon shop"

P.S: If you need the cmd tell.


Re: How do i suppose to do it? - Capua - 18.11.2014

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, range, x, y, z)
    return SendClientMessage(playerid, -1, "You are not in the weapon shop");



Re: How do i suppose to do it? - Write - 18.11.2014

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(IsPlayerInRangeOfPoint(playerid, 3, 296.5538,-38.1188,1001.5156))
  {
     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper\nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
  }
  else SendClientMessage(playerid, -1, "You are not at the weapon shop!");
  SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156);
  SendClientMessage(playerid, -1, "You have entered the weapon shop");
  return 1;
}
Like this.


Re: How do i suppose to do it? - Kyance - 18.11.2014

Quote:
Originally Posted by Turn
Посмотреть сообщение
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(IsPlayerInRangeOfPoint(playerid, 3, 296.5538,-38.1188,1001.5156))
  {
     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper\nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
  }
  else SendClientMessage(playerid, -1, "You are not at the weapon shop!");
  SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156);
  SendClientMessage(playerid, -1, "You have entered the weapon shop");
  return 1;
}
Like this.
Nope, that will still set his position and send him the "You have entered the weapon shop" message.



pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, 296.5538,-38.1188,1001.5156))
    {
        SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156), SendClientMessage(playerid, -1, "You have entered the weapon shop");
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper\nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
    }
    return 1;
}



Re: How do i suppose to do it? - Glossy42O - 18.11.2014

Ain't workin, Compiles perfectly but when i use /weaponshop i can buy weapons.


Re: How do i suppose to do it? - Write - 18.11.2014

Quote:
Originally Posted by Kyance
Посмотреть сообщение
Nope, that will still set his position and send him the "You have entered the weapon shop" message.



pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, 296.5538,-38.1188,1001.5156))
    {
        SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156), SendClientMessage(playerid, -1, "You have entered the weapon shop");
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper\nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
    }
    return 1;
}
lol? it was his script I just fixed it for him why would I want to remove his messages?


Quote:
Originally Posted by Stuun
Посмотреть сообщение
Ain't workin, Compiles perfectly but when i use /weaponshop i can buy weapons.
? According to the script, you're not supposed to write any command but just enter a checkpoint that is located at 296.5538,-38.1188,1001.5156.


Re: How do i suppose to do it? - Kyance - 18.11.2014

Quote:
Originally Posted by Turn
Посмотреть сообщение
lol? it was his script I just fixed it for him why would I want to remove his messages?
nvm xd



Stuun, you can try doing,

pawn Код:
CMD:weaponshop(playerid, params[]) {
    OnPlayerEnterCheckpoint(playerid);
    return 1;
}
... but that wouldn't work on servers which have race checkpoints.

The only thing I can think of for you to do is remove the "IsPlayerInRangeOfPoint" at the "OnPlayerEnterCheckpoint" callback, and add it on the "weaponshop", ex:
pawn Код:
CMD:weaponshop(playerid, params[]) {
    if(IsPlayerInRangeOfPoint(playerid, 5, 296.5538,-38.1188,1001.5156))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper   \nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
        SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156), SendClientMessage(playerid, -1, "You have entered the weapon shop");
    }
    else SendClientMessage(playerid, -1, "You are not at the weapon shop!");
    return 1;
}



Re: How do i suppose to do it? - Runn3R - 18.11.2014

Quote:
Originally Posted by Kyance
Посмотреть сообщение
nvm xd



Stuun, you can try doing,

pawn Код:
CMD:weaponshop(playerid, params[]) {
    OnPlayerEnterCheckpoint(playerid);
    return 1;
}
... but that wouldn't work on servers which have race checkpoints.

The only thing I can think of for you to do is remove the "IsPlayerInRangeOfPoint" at the "OnPlayerEnterCheckpoint" callback, and add it on the "weaponshop", ex:
pawn Код:
CMD:weaponshop(playerid, params[]) {
    if(IsPlayerInRangeOfPoint(playerid, 5, 296.5538,-38.1188,1001.5156))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper   \nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
        SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156), SendClientMessage(playerid, -1, "You have entered the weapon shop");
    }
    else SendClientMessage(playerid, -1, "You are not at the weapon shop!");
    return 1;
}
What the.... fuq is this?

pawn Код:
CMD:weaponshop(playerid, params[]) {
    OnPlayerEnterCheckpoint(playerid);
    return 1;
}
Calling a callback? The foq r u doin. Get your shit together m8.
He just wanted the command why are you doing the checkpoints and shit.

pawn Код:
CMD:weaponshop(playerid, params[])
        {
        if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)// your co-ordinates here m8
           return SendClientMessage(playerid, -1, "You are not in the weapon shop");
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your weapon", "Deagle\nShotgun\nSniper   \nM4\nMP5\nCombat\nGrenade\nTec9", "Purchase", "Exit");
        SetPlayerPos(playerid, 286.9429,-37.3731,1001.5156), SendClientMessage(playerid, -1, "You have entered the weapon shop");
    return 1;
}



Re: How do i suppose to do it? - Capua - 18.11.2014

Quote:
Originally Posted by Kyance
Посмотреть сообщение
Stuun, you can try doing,

pawn Код:
CMD:weaponshop(playerid, params[]) {
    OnPlayerEnterCheckpoint(playerid);
    return 1;
}
Now that makes as much sense as putting a woman and a mouse in the same room D


Re: How do i suppose to do it? - Abagail - 18.11.2014

You can use IsPlayerInCheckpoint, along with IsPlayerInRangeOfPoint. This is actually really easy.