- Регистрация
- 19 Фев 2012
- Сообщения
- 101
- Лучшие ответы
- 0
- Репутация
- 16
Уважаемые пользователи,очень нуждаюсь в вашей помощи.Данный скрипт служит для выбрасывание/поднятие оружия:
Ниже Античит который стоит на сервере:
Вопрос: Почему при выбрасывании или поднятии оружия все получают Кик и как эту проблемму можно исправить?
Заранее вам всем благодарен.
#define FILTERSCRIPT
#include <a_samp>
// Configs:
#define MAX_OBJ 50 // Limit
#define SAVING // Uncomment this line if you want to save dropped guns to restore them after FS restarts
// -----------------------------------------------------------------------------
enum dGunEnum
{
Float:ObjPos[3],
ObjID,
ObjData[2]
};
new dGunData[MAX_OBJ][dGunEnum];
// -----------------------------------------------------------------------------
new GunNames[48][] = {
"Nothink", "Brass Knuckles", "Golf Club", "Nitestick", "Knife", "Baseball Bat",
"Showel", "Pool Cue", "Katana", "Chainsaw", "Purple Dildo", "Small White Dildo",
"Long White Dildo", "Vibrator", "Flowers", "Cane", "Grenade", "Tear Gas", "Molotov",
"Vehicle Missile", "Hydra Flare", "Jetpack", "Glock", "Silenced Colt", "Desert Eagle",
"Shotgun", "Sawn Off", "Combat Shotgun", "Micro UZI", "MP5", "AK47", "M4", "Tec9",
"Rifle", "Sniper Rifle", "Rocket Launcher", "HS Rocket Launcher", "Flamethrower", "Minigun",
"Satchel Charge", "Detonator", "Spraycan", "Fire Extinguisher", "Camera", "Nightvision",
"Infrared Vision", "Parachute", "Fake Pistol"
};
// -----------------------------------------------------------------------------
new GunObjects[47] = {
0,331,333,334,335,336,337,338,339,341,321,322,323,324,325,326,342,343,344,
0,0,0,346,347,348,349,350,351,352,353,355,356,372,357,358,359,360,361,362,
363,364,365,366,367,368,368,371
};
// -----------------------------------------------------------------------------
public OnFilterScriptInit()
{
for(new n = 0; n < MAX_OBJ; n++) dGunData[n][ObjID] = -1;
print("\n");
print(" Drop Gun [FS] By Yumes_Dany (c)");
print(" Do not remove copyright!!!");
print(" Version 1.3\n");
#if defined SAVING
new File:file = fopen("DroppedGuns.ini", io_read);
if(file)
{
new buffer[256], FileCoords[5][20];
for(new g = 0; g < MAX_OBJ; g++)
{
fread(file, buffer);
split(buffer, FileCoords, ',');
dGunData[g][ObjPos][0] = floatstr(FileCoords[0]);
dGunData[g][ObjPos][1] = floatstr(FileCoords[1]);
dGunData[g][ObjPos][2] = floatstr(FileCoords[2]);
dGunData[g][ObjData][0] = strval(FileCoords[3]);
dGunData[g][ObjData][1] = strval(FileCoords[4]);
if(dGunData[g][ObjData][0] > 0 && dGunData[g][ObjData][1] != 0 && dGunData[g][ObjPos][0] != 0)
{
dGunData[g][ObjID] = CreateObject(GunObjects[dGunData[g][ObjData][0]], dGunData[g][ObjPos][0], dGunData[g][ObjPos][1], dGunData[g][ObjPos][2]-1, 93.7, 120.0, 120.0);
printf("* %s loaded: %f,%f,%f", GunNames[dGunData[g][ObjData][0]], dGunData[g][ObjPos][0], dGunData[g][ObjPos][1], dGunData[g][ObjPos][2]-1);
}
}
}
else print("ERROR: Failed to open \"DroppedGuns.ini\"");
#endif
return 1;
}
// -----------------------------------------------------------------------------
public OnFilterScriptExit()
{
#if defined SAVING // Introducere
new File:file = fopen("DroppedGuns.ini", io_append);
if(file)
{
fclose(file);
for(new g = 0, buffer[50]; g < MAX_OBJ; g++)
{
format(buffer, sizeof(buffer), "%f,%f,%f,%d,%d\n",
dGunData[g][ObjPos][0],
dGunData[g][ObjPos][1],
dGunData[g][ObjPos][2],
dGunData[g][ObjData][0],
dGunData[g][ObjData][1]);
if(g == 0) file = fopen("DroppedGuns.ini", io_write);
else file = fopen("DroppedGuns.ini", io_append);
fwrite(file, buffer);
fclose(file);
if(dGunData[g][ObjData][0] > 0 && dGunData[g][ObjPos][1] != 0)
{
DestroyObject(dGunData[g][ObjID]);
printf("* %s saved: %f,%f,%f", GunNames[dGunData[g][ObjData][0]], dGunData[g][ObjPos][0], dGunData[g][ObjPos][1], dGunData[g][ObjPos][2]-1);
}
}
}
else print("ERROR: Failed to open \"DroppedGuns.ini\"");
#endif
return 1;
}
// -----------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/dropgun", true) == 0
|| strcmp(cmdtext, "/dgun", true) == 0)
{
if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
new GunID = GetPlayerWeapon(playerid);
new GunAmmo = GetPlayerAmmo(playerid);
if(GunID > 0 && GunAmmo != 0)
{
new f = MAX_OBJ+1;
for(new a = 0; a < MAX_OBJ; a++)
{
if(dGunData[a][ObjPos][0] == 0.0)
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "Nu puteti arunca arme acum,incercati mai tarziu!");
RemovePlayerWeapon(playerid, GunID);
dGunData[f][ObjData][0] = GunID;
dGunData[f][ObjData][1] = GunAmmo;
GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
new buffer[50];
format(buffer, sizeof(buffer), "Ati aruncat un %s", GunNames[dGunData[f][ObjData][0]]);
SendClientMessage(playerid, 0x33AA3300, buffer);
}
return 1;
}
if(strcmp(cmdtext, "/pickupgun", true) == 0
|| strcmp(cmdtext, "/pgun", true) == 0)
{
if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
new f = MAX_OBJ+1;
for(new a = 0; a < MAX_OBJ; a++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "Nu va aflati langa arma pe care doriti sa o ridicati!");
DestroyObject(dGunData[f][ObjID]);
GivePlayerWeapon(playerid, dGunData[f][ObjData][0], dGunData[f][ObjData][1]);
dGunData[f][ObjPos][0] = 0.0;
dGunData[f][ObjPos][1] = 0.0;
dGunData[f][ObjPos][2] = 0.0;
dGunData[f][ObjID] = -1;
//dGunData[f][ObjData][0] = 0;
dGunData[f][ObjData][1] = 0;
new buffer[50];
format(buffer, sizeof(buffer), "Ati ridicat un %s", GunNames[dGunData[f][ObjData][0]]);
SendClientMessage(playerid, 0x33AA3300, buffer);
return 1;
}
return 0;
}
// -----------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
new FloatPosX, FloatPosY, FloatPosZ;
GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
for(new i_slot = 0, gun, ammo; i_slot != 12; i_slot++)
{
GetPlayerWeaponData(playerid, i_slot, gun, ammo);
if(gun != 0 && ammo != 0) CreateDroppedGun(gun, ammo, pPosX+random(2)-random(2), pPosY+random(2)-random(2), pPosZ);
}
return 1;
}
stock CreateDroppedGun(GunID, GunAmmo, Float:gPosX, Float:gPosY, Float:gPosZ)
{
new f = MAX_OBJ+1;
for(new a = 0; a < MAX_OBJ; a++)
{
if(dGunData[a][ObjPos][0] == 0.0)
{
f = a;
break;
}
}
if(f > MAX_OBJ) return;
dGunData[f][ObjData][0] = GunID;
dGunData[f][ObjData][1] = GunAmmo;
dGunData[f][ObjPos][0] = gPosX;
dGunData[f][ObjPos][1] = gPosY;
dGunData[f][ObjPos][2] = gPosZ;
dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, random(360));
return;
}
// -----------------------------------------------------------------------------
stock RemovePlayerWeapon(playerid, weaponid)
{ // Not mine :3
new plyWeapons[12] = 0;
new plyAmmo[12] = 0;
for(new sslot = 0; sslot != 12; sslot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, sslot, wep, ammo);
if(wep != weaponid && ammo != 0) GetPlayerWeaponData(playerid, sslot, plyWeapons[sslot], plyAmmo[sslot]);
}
ResetPlayerWeapons(playerid);
for(new sslot = 0; sslot != 12; sslot++) if(plyAmmo[sslot] != 0) GivePlayerWeapon(playerid, plyWeapons[sslot], plyAmmo[sslot]);
return 1;
}
stock split(const strsrc[], strdest[][], delimiter)
{ // Not mine :3
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc))
{
if(strsrc==delimiter || i==strlen(strsrc))
{
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
Ниже Античит который стоит на сервере:
//======================Anticheat=================================================
public CheckCheaters()
{
new gunname[32];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!GetPVarInt(i, "NoAB"))
{
new State = GetPlayerState(i);
if(State != PLAYER_STATE_PASSENGER)
{
if(IsPlayerConnected(i))
{
if(PyxiTime == 0)
{
new gun[12], ammo[12], cheater = 0;
for(new gn = 0; gn < 12; gn++)
{
GetPlayerWeaponData(i,gn,gun[gn],ammo[gn]);
}
cheatergun(i);
/* if(PlayerInfo[pGun0] == 0 && gun[0] > 0)//Pumnul, brass knucles
{
GetWeaponNameEx(gun[0],gunname,sizeof(gunname)); cheater = 1;
}
if(PlayerInfo[pGun1] == 0 && gun[1] > 0)//arme de maini
{
GetWeaponNameEx(gun[1],gunname,sizeof(gunname)); cheater = 1;
}*/
if(PlayerInfo[pSlotammo2] != ammo[2])//Pisotoale,gloante
{
if(PlayerInfo[pSlotammo2] > ammo[2] && ammo[2] >= 0 && PlayerInfo[pSlot2] != 0 && IsAPistol(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo2] = ammo[2];
else if(PlayerInfo[pSlotammo2] < ammo[2] && IsAPistol(GetPlayerWeapon(i)))
{
if(PlayerInfo[pSlotammo2] < 0)
PlayerInfo[pSlotammo2] = 0;
else
{
GetWeaponNameEx(gun[2],gunname,sizeof(gunname));
cheater = 2;
}
}
}
if(PlayerInfo[pSlotammo3] != ammo[3])//Sawn of Shootguns, gloante
{
if(PlayerInfo[pSlotammo3] > ammo[3] && ammo[3] >= 0 && PlayerInfo[pSlot3] != 0 && IsAShotgun(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo3] = ammo[3];
else if(PlayerInfo[pSlotammo3] < ammo[3])
{
if(PlayerInfo[pSlotammo3] < 0)
PlayerInfo[pSlotammo3] = 0;
else
{
GetWeaponNameEx(gun[3],gunname,sizeof(gunname));
cheater = 2;
}
}
}
if(PlayerInfo[pSlotammo4] != ammo[4])//Automate, gloante
{
if(PlayerInfo[pSlotammo4] > ammo[4] && ammo[4] >= 0 && PlayerInfo[pSlot4] != 0 && IsAShotgun(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo4] = ammo[4];
else if(PlayerInfo[pSlotammo4] < ammo[4])
{
if(PlayerInfo[pSlotammo4] < 0)
PlayerInfo[pSlotammo4] = 0;
else
{
GetWeaponNameEx(gun[4],gunname,sizeof(gunname));
cheater = 2;
}
}
}
if(PlayerInfo[pSlotammo5] != ammo[5])//Combat Shotguns, gloante
{
if(PlayerInfo[pSlotammo5] > ammo[5] && PlayerInfo[pSlot5] != 0 && IsAnAssault(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo5] = ammo[5];
else if(PlayerInfo[pSlotammo5] < ammo[5] && ammo[5] >= 0 )
{
if(PlayerInfo[pSlotammo5] < 0)
PlayerInfo[pSlotammo5] = 0;
else
{
GetWeaponNameEx(gun[5],gunname,sizeof(gunname));
cheater = 2;
}
}
}
if(PlayerInfo[pSlotammo6] != ammo[6])//Pusti, gloante
{
if(PlayerInfo[pSlotammo6] > ammo[6] && PlayerInfo[pSlot6] != 0 && IsARifle(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo6] = ammo[6];
else if(PlayerInfo[pSlotammo6] < ammo[6] && ammo[6] >= 0)
{
if(PlayerInfo[pSlotammo6] < 0)
PlayerInfo[pSlotammo6] = 0;
else
{
GetWeaponNameEx(gun[6],gunname,sizeof(gunname));
cheater = 2;
}
}
}
if(PlayerInfo[pSlotammo7] != ammo[7])//Arme puternice, gloante
{
if(PlayerInfo[pSlotammo7] > ammo[7] && PlayerInfo[pSlot7] != 0 && IsAHeavyAssault(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo7] = ammo[7];
else if(PlayerInfo[pSlotammo7] < ammo[7] && ammo[7] >= 0)
{
if(PlayerInfo[pSlotammo7] < 0)
PlayerInfo[pSlotammo7] = 0;
else
{
GetWeaponNameEx(gun[7],gunname,sizeof(gunname));
cheater = 2;
}
}
}
if(PlayerInfo[pSlotammo9] != ammo[9])//Obiecte, gloante
{
if(PlayerInfo[pSlotammo9] > ammo[9] && PlayerInfo[pSlot9] != 0 && IsAStuff1(GetPlayerWeapon(i)))
PlayerInfo[pSlotammo9] = ammo[9];
else if(PlayerInfo[pSlotammo9] < ammo[9] && ammo[9] >= 0)
{
if(PlayerInfo[pSlotammo9] < 0)
PlayerInfo[pSlotammo9] = 0;
else
{
GetWeaponNameEx(gun[9],gunname,sizeof(gunname));
cheater = 2;
}
}
}
new string[128];
new plname[MAX_PLAYER_NAME];
new ip[256];
new weaponid;
GetWeaponName(weaponid, gunname, sizeof(gunname));
if(cheater == 2 && PyxiTime == 0)
{
guncheat =1;
GetPlayerName(i, plname, MAX_PLAYER_NAME);
GetPlayerIp(i,ip,sizeof(ip));
format(string,sizeof(string),"- A primit Kick %s | Gloante la arma | Level: %d | Warns: %d | IP: %s",plname,PlayerInfo[pLevel],PlayerInfo[pWarns],ip);
ABroadCast(COLOR_LIGHTRED,string,1);
SetPlayerHealthAC(i, 0);
Delgun(i);
ResetPlayerWeapons(i);
PlayerInfo[pSlot2] = 0;
PlayerInfo[pSlot3] = 0;
PlayerInfo[pSlot4] = 0;
PlayerInfo[pSlot5] = 0;
PlayerInfo[pSlot6] = 0;
PlayerInfo[pSlot7] = 0;
PlayerInfo[pSlot8] = 0;
PlayerInfo[pSlot9] = 0;
PlayerInfo[pSlot10] = 0;
PlayerInfo[pSlot11] = 0;
Kick(i);
return 1;
}
}
}
}
}
}
return 1;
}
stock GetWeaponNameEx(id, name[], len) return format(name,len, "%s", GunNames[id]);
stock IsAPistol(gunid)
{
if(gunid >= 22 && gunid <=24)
{
return 1;
}
return 0;
}
stock IsAMelee(gunid)
{
if(gunid >= 2 && gunid <= 9 )
{
return 1;
}
return 0;
}
stock IsAGirlsStuff(gunid)
{
if(gunid >= 10 && gunid <= 15 || gunid == 46)
{
return 1;
}
return 0;
}
stock IsAGrenade(gunid)
{
if((gunid >= 16 && gunid <= 18) || gunid == 39)
{
return 1;
}
return 0;
}
stock IsAShotgun(gunid)
{
if(gunid >= 25 && gunid <= 27)
{
return 1;
}
return 0;
}
stock IsAMachineGun(gunid)
{
if(gunid == 28 || gunid == 29 || gunid == 32)
{
return 1;
}
return 0;
}
stock IsAnAssault(gunid)
{
if(gunid == 30 || gunid == 31)
{
return 1;
}
return 0;
}
stock IsARifle(gunid)
{
if(gunid == 33 || gunid == 34)
{
return 1;
}
return 0;
}
stock IsAHeavyAssault(gunid)//bazooka
{
if(gunid >= 35 && gunid <= 37 )
{
return 1;
}
return 0;
}
stock IsAStuff1(gunid)//spray
{
if(gunid >= 41 && gunid <= 43 )
{
return 1;
}
return 0;
}
stock GiveRichGun(playerid,weaponid,ammo)
{
PyxiTime[playerid] = 5;
if(IsAPistol(weaponid))
{
PlayerInfo[playerid][pSlot2] = weaponid;
PlayerInfo[playerid][pSlotammo2] += ammo;
}
else if(IsAShotgun(weaponid))
{
PlayerInfo[playerid][pSlot3] = weaponid;
PlayerInfo[playerid][pSlotammo3] += ammo;
}
else if(IsAMachineGun(weaponid))
{
PlayerInfo[playerid][pSlot4] = weaponid;
PlayerInfo[playerid][pSlotammo4] += ammo;
}
else if(IsAnAssault(weaponid))
{
PlayerInfo[playerid][pSlot5] = weaponid;
PlayerInfo[playerid][pSlotammo5] += ammo;
}
else if(IsARifle(weaponid))
{
PlayerInfo[playerid][pSlot6] = weaponid;
PlayerInfo[playerid][pSlotammo6] += ammo;
}
else if(IsAHeavyAssault(weaponid))
{
PlayerInfo[playerid][pSlot7] = weaponid;
PlayerInfo[playerid][pSlotammo7] += ammo;
}
else if(IsAHeavyAssault(weaponid))
{
PlayerInfo[playerid][pSlot7] = weaponid;
PlayerInfo[playerid][pAmmo7] += ammo;
}
else if(IsAGrenade(weaponid))
{
PlayerInfo[playerid][pSlot8] = weaponid;
PlayerInfo[playerid][pSlotammo8] += ammo;
}
else if(IsAStuff1(weaponid))
{
PlayerInfo[playerid][pSlot9] = weaponid;
PlayerInfo[playerid][pSlotammo9] += ammo;
}
else if(IsAGirlsStuff(weaponid))
{
PlayerInfo[playerid][pSlot10] = weaponid;
PlayerInfo[playerid][pSlotammo10] += ammo;
}
GivePlayerWeapon(playerid,weaponid,ammo);
return 1;
}
stock GetSRVMoney(playerid)
{
return PlayerInfo[playerid][pCash];
}
public Delgun(playerid)
{
PyxiTime[playerid] = 5;
PlayerInfo[playerid][pSlot1] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot2] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot3] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot4] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot5] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot6] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot7] = 0;//Arma slot 2
PlayerInfo[playerid][pSlot8] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo2] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo3] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo4] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo5] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo6] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo7] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo8] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo9] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo10] = 0;//Arma slot 2
PlayerInfo[playerid][pSlotammo11] = 0;//Arma slot 2
ResetPlayerWeapons(playerid);
return 1;
}
Вопрос: Почему при выбрасывании или поднятии оружия все получают Кик и как эту проблемму можно исправить?
Заранее вам всем благодарен.