SA-MP Forums Archive
Help... - 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: Help... (/showthread.php?tid=311203)



Help... - Littlehelper - 15.01.2012

Hello,
i've got a little problem right here...
pawn Code:
if (strcmp("/buy", cmdtext, true, 10) == 0){
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 368.6851,-1279.7899,13.5469))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"You Are Not Near Ammu-Nation Entrance!");
        ShowPlayerDialog(playerid, 3,DIALOG_STYLE_LIST, "{F81414}Ammu-Nation!","1.Ak47 {4500$} \n2.M4 {4800$} \n3.Deagle {1600$} \n4. SawnOff {2700$} \n5.Silenced Pistol {1950$}.","Okay","Cancel");
    }
    return 1;
    }
This looks cool, but IsPlayerInRangeOfPoint Is not Working, And players can type /Buy anywhere...
Any kind of help in this will be appreciated muchly.
Thankx.


Re: Help... - mSp - 15.01.2012

pawn Code:
if (strcmp("/buy", cmdtext, true, 4) == 0){
  if(IsPlayerInRangeOfPoint(playerid, 2.0, 368.6851,-1279.7899,13.5469))
    {
    ShowPlayerDialog(playerid, 3,DIALOG_STYLE_LIST, "{F81414}Ammu-Nation!","1.Ak47 {4500$} \n2.M4 {4800$} \n3.Deagle {1600$} \n4. SawnOff {2700$} \n5.Silenced Pistol {1950$}.","Okay","Cancel");
    }
    else
    {
    SendClientMessage(playerid,0xFFFFFFFF,"You Are Not Near Ammu-Nation Entrance!");
    }
    return 1;
    }



Re: Help... - Konstantinos - 15.01.2012

pawn Code:
if(strcmp("/buy", cmdtext, true, 4) == 0) { // 4 Chars, not 10.
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 368.6851,-1279.7899,13.5469))return SendClientMessage(playerid,0xFFFFFFFF,"You Are Not Near Ammu-Nation Entrance!");
    else return ShowPlayerDialog(playerid, 3,DIALOG_STYLE_LIST, "{F81414}Ammu-Nation!","1.Ak47 {4500$} \n2.M4 {4800$} \n3.Deagle {1600$} \n4. SawnOff {2700$} \n5.Silenced Pistol {1950$}.","Okay","Cancel");
}



Re: Help... - Littlehelper - 15.01.2012

Thankx.


Re: Help... - Littlehelper - 16.01.2012

Hello,
Another Problem Here.....
pawn Code:
{
if(pickupid == Mypickup)
{
SendClientMessage(playerid,COLOR_RED,"You Are At Ammu-nation, Type /buy");
}
return 1;
}
When player reaches at tha pickup it dosent show anything :\
pawn Code:
Mypickup = CreatePickup(1318,2,1368.6851,-1279.7899,13.5469,0);



Re: Help... - Jaxson - 16.01.2012

pawn Code:
{
if(pickupid == Mypickup)
{
SendClientMessage(playerid,COLOR_RED,"You Are At Ammu-nation, Type /buy");
}
return 1;
}
Is this code placed under OnPlayerPickupPickup?


Re: Help... - Littlehelper - 16.01.2012

Yes.


Re: Help... - Littlehelper - 16.01.2012

pawn Code:
forward OnPlayerPickupPickup(pickupid,playerid);
public OnPlayerPickupPickup(pickupid,playerid)
{
if(pickupid == Mypickup)
{
SendClientMessage(playerid,COLOR_RED,"You Are At Ammu-nation, Type /buy");
}
return 1;
}
looks like this.


Re: Help... - Jaxson - 16.01.2012

Alright, the declaration of Mypickup variable is placed under OnGameModeInit callback, right?


Re: Help... - Littlehelper - 16.01.2012

Yes.....
As i said, everything is right in the way it was supposed to be, but still problems are occurin'


Re: Help... - Jaxson - 16.01.2012

Rename the OnPlayerPickupPickup(pickupid,playerid) to OnPlayerPickUpPickup(playerid,pickupid) and remove the forward at the beginning. Should work then.


Re: Help... - Littlehelper - 16.01.2012

Oh thankx, it works now.
+rep


Re: Help... - Jaxson - 16.01.2012

No problem.