26.09.2011, 16:57
Hello,
I've created a very basic anti weapon cheat but he bug.., so here the code:
This anti-cheat bug, when a player connect, it automaticly ban him, I really don't know why..
Second problem:
How to stores values in inputtext?
For exemple,
This code do absolutly nothing.. I don't know why..
Thanks for your help,
Sreadon.
Ah, and if you have time, please check at this link.. : Link
I've created a very basic anti weapon cheat but he bug.., so here the code:
pawn Код:
At the top..:
forward anticheat(playerid);
In OnGameModeInit:
SetTimer("anticheat", 1000, 1); //So, the public anticheat() will be call every seconds, to prevent lags.
And at the end:
public anticheat(playerid)
{
new string[256], plname[64];
if(IsPlayerConnected(playerid))
{
if(GetPlayerWeapon(playerid) == 38)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Minigun)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 9)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Tronзoneuse)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 16)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Grenade)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 26)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Shawn-off)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 36)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Lance Roquette automatique)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 37)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Lance-Flammes)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 39)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Charges explosives)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
if(GetPlayerWeapon(playerid) == 44 || GetPlayerWeapon(playerid) == 45)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
return 1;
}
else
{
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "[SERVEUR]: [%s] а йtй banni par l'Anti-Cheat. [Raison]: Triche Arme (Lunettes de vision nocturne)", plname);
SendClientMessageToAll(COLOR_RED,string);
Ban(playerid);
}
}
}
return 1;
}
Second problem:
How to stores values in inputtext?
For exemple,
pawn Код:
if(response)
{
switch(dialogid == 3901)
{
case 1:
{
switch(listitem)
{
case 0:
{
if(strlen(inputtext) > 0)
{
PlayerInfo[playerid][pEmail] = inputtext[64]; // Yeah, it's big for a password..
OnPlayerUpdate(playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFAA,"Erreur, texte trop court.");
}
}
}
}
}
}
Thanks for your help,
Sreadon.
Ah, and if you have time, please check at this link.. : Link