SA-MP Forums Archive
Ammunation weapons buying - 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: Ammunation weapons buying (/showthread.php?tid=456998)



Ammunation weapons buying - lider1241 - 08.08.2013

I build a little dialog for /buyguns on ammunation interior, when i buy for example a MM9 i getting banned for weapon hacking... and IsPlayerInRangeOfPoints doesnt work too.
please help what i doing wrong and what code for cancel the anticheat on /buyguns

Код:
#include <a_samp>
#include <zcmd>

// Goverment Ammunation
// Legal Weapons

#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN 0x80FF00AA
#define COLOR_GREY 0xAFAFAFAA

CMD:buyguns(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
 {
  SendClientMessage(playerid,COLOR_GREY,"   You are not at the Goverment Ammunation!");
}
  
        ShowPlayerDialog(playerid,253,DIALOG_STYLE_LIST,"{808080}Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000{FFFFFF}","Select", "Back");
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == 253)
        {
        if(response)
        {
        if(listitem == 0)
        {
        if(GetPlayerMoney(playerid) > 1000)
        {
                GivePlayerMoney(playerid, -1000);
                GameTextForPlayer(playerid, "~r~ -1000$", 5000, 1);
                GivePlayerWeapon(playerid, 22, 99999);
        }else{SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
        }
        if(listitem == 1)
        {
        if(GetPlayerMoney(playerid) > 5000)
        {
                GivePlayerMoney(playerid, -5000);
                GameTextForPlayer(playerid, "~r~ -5000$", 5000, 1);
                GivePlayerWeapon(playerid, 25, 99999);
        }else{SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
        }
        if(listitem == 2)
        {
        if(GetPlayerMoney(playerid) > 10000)
        {
                GivePlayerMoney(playerid, -10000);
                GameTextForPlayer(playerid, "~r~ -10000$", 5000, 1);
                GivePlayerWeapon(playerid, 33, 99999);
        }else{SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
        }
        }
        }
        return 1;
}



Re: Ammunation weapons buying - Misiur - 08.08.2013

Your anticheat is not present in this code, so you have to edit filterscript containing it.
You have to add "return" before SendClientMessage, so the code isn't executed any further.
Learn how to indent your code properly, now it looks terrible.


Re: Ammunation weapons buying - lider1241 - 08.08.2013

I pawn scripting beginner :/
At leaset how do i fix that? there is a code that block the anticheat and make the anticheat think it normal shop or something like that? BTW, IsPlayerInrRangeOfPoint not working, how do i fix that?


Re: Ammunation weapons buying - Konstantinos - 08.08.2013

Add your weapons stuff where the anticheat is. There are some of them - anticheats with server-side weapons and you should give the weapon with a custom function (so it will be recognized as registered weapon on the server).

PS: Your location says "Learning Pawno", I wonder how it is to learn an editor! It's called Pawn.


Re: Ammunation weapons buying - lider1241 - 08.08.2013

Well as i said i pawn beginner, how can i find my "weapon with a custom function"?