PDA

View Full Version : Ammu shop RP


lider1241
11/08/2013, 01:59 PM
i try to make /buyguns InRangeOfPoints in ammunation, its works perfect but when i i buy like MM9 i getting banned from my server...

can you help me with that? here a code


#include <a_samp>
#include <zcmd>

// Goverment Ammunation
// Legal Weapons

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

CMD:buyguns(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not at the Goverment Ammunation!");
return 1;
}

ShowPlayerDialog(playerid,253,DIALOG_STYLE_LIST,"{0xFFFFFFAA}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, 60000);
}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, 60000);
}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, 60000);
}else{SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
}
}
}
return 1;
}


BTW it FS.

Please help me how do i make it prevent ban by /buyguns command on ammunation

Mattakil
11/08/2013, 02:19 PM
Are you using a custom gamemode or edited?

Donvalley
11/08/2013, 02:21 PM
means that somewhere in your gamemode you have a weapon anti-cheat what gamemode you using?

check in your gamemode that certain weapons aren't being blocked resulting in a ban.

such as:


if(GetPlayerWeapon(playerid) == 38) //Minigun
{
Ban(playerid);
return 1;
}

Originality
11/08/2013, 02:25 PM
You're using an anti-cheat, which means somewhere in your code you'll have a stock to check for weapons. Therefore, there'll be a stock such as GivePlayerValidWeapon or GivePlayerWeaponEx to give valid weapons without the player being banned.

Look through weapon-related code in the script to find it.

lider1241
11/08/2013, 04:24 PM
I'm using NGRP mode, here the whole anticheat code:

GivePlayerValidWeapon( playerid, WeaponID, Ammo )
{
if((PlayerInfo[playerid][pConnectTime] < 2 || PlayerInfo[playerid][pWRestricted] > 0) && WeaponID != 46 && WeaponID != 43) return 1;
switch( WeaponID )
{
case 0, 1:
{
PlayerInfo[playerid][pGuns][ 0 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
PlayerInfo[playerid][pGuns][ 1 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 22, 23, 24:
{
PlayerInfo[playerid][pGuns][ 2 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 25, 26, 27:
{
PlayerInfo[playerid][pGuns][ 3 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 28, 29, 32:
{
PlayerInfo[playerid][pGuns][ 4 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 30, 31:
{
PlayerInfo[playerid][pGuns][ 5 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 33, 34:
{
PlayerInfo[playerid][pGuns][ 6 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 35, 36, 37, 38:
{
PlayerInfo[playerid][pGuns][ 7 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 16, 17, 18, 39, 40:
{
PlayerInfo[playerid][pGuns][ 8 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 41, 42, 43:
{
PlayerInfo[playerid][pGuns][ 9 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 10, 11, 12, 13, 14, 15:
{
PlayerInfo[playerid][pGuns][ 10 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 44, 45, 46:
{
PlayerInfo[playerid][pGuns][ 11 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
}
return 1;
}

GetWeaponSlot(weaponid)
{
switch( weaponid )
{
case 0, 1:
{
return 0;
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
return 1;
}
case 22, 23, 24:
{
return 2;
}
case 25, 26, 27:
{
return 3;
}
case 28, 29, 32:
{
return 4;
}
case 30, 31:
{
return 5;
}
case 33, 34:
{
return 6;
}
case 35, 36, 37, 38:
{
return 7;
}
case 16, 17, 18, 39, 40:
{
return 8;
}
case 41, 42, 43:
{
return 9;
}
case 10, 11, 12, 13, 14, 15:
{
return 10;
}
case 44, 45, 46:
{
return 11;
}
}
return -1;
}


ExecuteHackerAction( playerid, weaponid )
{
if(!gPlayerLogged{playerid}) { return 1; }
if(PlayerInfo[playerid][pTut] == 0) { return 1; }
if(playerTabbed[playerid] == 1) { return 1; }
if(GetPVarInt(playerid, "IsInArena") >= 0) { return 1; }

new String[ 128 ], WeaponName[ 128 ];
GetWeaponName( weaponid, WeaponName, sizeof( WeaponName ) );

format( String, sizeof( String ), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may possibly be weapon hacking (%s).", GetPlayerNameEx(playerid), playerid, WeaponName );
ABroadCast( COLOR_YELLOW, String, 2 );
format(String, sizeof(String), "%s (ID %d) may possibly be weapon hacking (%s)", GetPlayerNameEx(playerid), playerid, WeaponName);
Log("logs/hack.log", String);

return 1;
}

IsValidIP(ip[])
{
new a;
for (new i = 0; i < strlen(ip); i++)
{
if (ip[i] == '.')
{
a++;
}
}
if (a != 3)
{
return 1;
}
return 0;
}

CheckBan(ip[])
{
new string[20];
new File: file = fopen("ban.cfg", io_read);
while(fread(file, string))
{
if (strcmp(ip, string, true, strlen(ip)) == 0)
{
fclose(file);
return 1;
}
}
fclose(file);
return 0;
}

AddBan(ip[])
{
if (CheckBan(ip) == 0)
{
new File: file = fopen("ban.cfg", io_append);
new string[20];
format(string, sizeof(string), "\n%s", ip);
fwrite(file, string);
fclose(file);
foreach(Player, playerid)
{
new playerIP[16];
GetPlayerIp(playerid, playerIP, sizeof(playerIP));
if (strcmp(playerIP, ip) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are banned from this server.");
Kick(playerid);
}
}
return 1;
}
return 0;
}

RemoveBan(ip[])
{
if (CheckBan(ip) == 1)
{
new string[20];
new File: file = fopen("ban.cfg", io_read);
fcreate("tempBan.cfg");
new File: file2 = fopen("tempBan.cfg", io_append);
while(fread(file, string))
{
if (strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\n", string) != 0)
{
fwrite(file2, string);
}
}
fclose(file);
fclose(file2);
file = fopen("ban.cfg", io_write);
file2 = fopen("tempBan.cfg", io_read);
while(fread(file2, string))
{
fwrite(file, string);
}
fclose(file);
fclose(file2);
fremove("tempBan.cfg");
return 1;
}
return 0;

Mattakil
11/08/2013, 05:01 PM
Thats not it, thats just the saving system, maybe a filterscript?

lider1241
11/08/2013, 05:42 PM
@Mattakil - No, its NGRP - it comes in the pwn file.
i looked on notepad++ with Ctrl F feature on words: anti, cheat but nothing found /:
The anti weapon hack is very good but if someone will know how can i make /buyguns and buy one without get any ban it will be good.

please anyone?