Small prob again ;P
#1

Hey,

I need help here again :

pawn Код:
public playerfoundweapon(playerid)
{
    if(CheatMsg == 1)
    if(PlayerInfo[playerid][Level] == 0)
    {
    new sendername[MAX_PLAYER_NAME];
    new string[255];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "Anti Cheat : %s has been banned (Reason : Weapon Cheats )", sendername);
    SendClientMessageToAll(0xFF000096,string);
    }
    SendClientMessage(playerid,0xFF000096,"If you think this was an unfair ban, make a unban appeal at : *******");
    ResetPlayerWeapons(playerid);
    return Ban(playerid);
}
A Anti cheat, but it bans admins too.
As u can see i added if(PlayerInfo[playerid][Level] == 0)
But it still bans admins if they do /giveweapon.. ;s Anyway that it doesn't bans admins?
Reply
#2

Код:
public playerfoundweapon(playerid)
{
    if ((PlayerInfo[playerid][Level] == 0) && (CheatMsg == 1))
    {
    	new sendername[MAX_PLAYER_NAME];
    	new string[255];
    	GetPlayerName(playerid, sendername, sizeof(sendername));
    	format(string, sizeof(string), "Anti Cheat : %s has been banned (Reason : Weapon Cheats )", sendername);
    	SendClientMessageToAll(0xFF000096,string);
	SendClientMessage(playerid,0xFF000096,"If you think this was an unfair ban, make a unban appeal at : *******");
    	ResetPlayerWeapons(playerid);
    	return Ban(playerid);
    }

    return 1;
}
Properly indent your code, then it's easier to fix such problems.
You've placed the second SendClientMessage, the ResetPlayerWeapons and the return Ban(playerid) lines outside the IF-statement.
Reply
#3

Thanks, but it still bans me if i give myself a forbidden weapon
Reply
#4

if(PlayerInfo[playerid][Level] >= 0) return 0;
else{
Reply
#5

still won't work D=

Look, first time i did it like this :

pawn Код:
public playerfoundweapon(playerid)
{
    if ((PlayerInfo[playerid][Level] >= 0) return 0; && (CheatMsg == 1))
    else{
//Other code bla bla bla
It gave me erros, so i did it like this :
pawn Код:
public playerfoundweapon(playerid)
{
    if ((PlayerInfo[playerid][Level] >= 0) && (CheatMsg == 1)) return 0;
    else{
//Other code bla bla
Then i get a warning, "Unreachable code" But it still bans me
I'm clueless
Thank you anyway.
Reply
#6

pawn Код:
public playerfoundweapon(playerid)
{
    if (PlayerInfo[playerid][Level] >= 0) && (CheatMsg == 1)) return 0;
    //code if player isn't admin
Reply
#7

This version is the correct one
pawn Код:
#define WEBSITE "www.balalbala.com"

public playerfoundweapon(playerid)
{
    if (PlayerInfo[playerid][Level] == 0)
    {
        if (CheatMsg == 1)
        {
            new string[128];
            GetPlayerName(playerid, string, MAX_PLAYER_NAME);
            format(string, sizeof(string), "Anti Cheat : %s has been banned (Reason : Weapon Cheats )", string);
            SendClientMessageToAll(0xFF000096, string);
        }
        SendClientMessage(playerid, 0xFF000096, "If you think this was an unfair ban, make a unban appeal at : " WEBSITE);
        Ban(playerid);
        return 1;
    }
    return 0;
}
This code bans you if your level is 0 and sends a global message if CheatMsg is 1

Quote:
Originally Posted by [SU]Balli
Посмотреть сообщение
But it still bans me
I'm clueless
And if it still bans you, did you ever thought that the reason could be somewhere else ? Maybe you call it on an false event
Reply
#8

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
This version is the correct one
pawn Код:
#define WEBSITE "www.balalbala.com"

public playerfoundweapon(playerid)
{
    if (PlayerInfo[playerid][Level] == 0)
    {
        if (CheatMsg == 1)
        {
            new string[128];
            GetPlayerName(playerid, string, MAX_PLAYER_NAME);
            format(string, sizeof(string), "Anti Cheat : %s has been banned (Reason : Weapon Cheats )", string);
            SendClientMessageToAll(0xFF000096, string);
        }
        SendClientMessage(playerid, 0xFF000096, "If you think this was an unfair ban, make a unban appeal at : " WEBSITE);
        Ban(playerid);
        return 1;
    }
    return 0;
}
Should be:

pawn Код:
#define WEBSITE "www.balalbala.com"

public playerfoundweapon(playerid)
{
    if (PlayerInfo[playerid][Level] == 0)
    {
        if (CheatMsg == 1)
        {
            new string[128];
            GetPlayerName(playerid, string, MAX_PLAYER_NAME);
            format(string, sizeof(string), "Anti Cheat : %s has been banned (Reason : Weapon Cheats )", string);
            SendClientMessageToAll(0xFF000096, string);
        }
        new string2[40];
        format(string2,sizeof(string2),"If you think this was an unfair ban, make an unban appeal at: %s",WEBSITE);
        SendClientMessage(playerid, 0xFF000096, string);
        Ban(playerid);
        return 1;
    }
    return 0;
}
You forgot the string for the website.
Reply
#9

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
You forgot the string for the website.
If WEBSITE would be an array, yes but WEBSITE is only a macro, so you can do it like

pawn Код:
SendClientMessage(playerid, 0xFF000096, "If you think this was an unfair ban, make a unban appeal at : " WEBSITE);
I think ****** wrote once a topic about macros ("Interesting Macros")
Reply
#10

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
If WEBSITE would be an array, yes but WEBSITE is only a macro, so you can do it like

pawn Код:
SendClientMessage(playerid, 0xFF000096, "If you think this was an unfair ban, make a unban appeal at : " WEBSITE);
I think ****** wrote once a topic about macros ("Interesting Macros")
Ah, I see, sorry for my epic-failness ;(

Balli, have you got a home-host?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)