SA-MP Forums Archive
Small prob again ;P - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Small prob again ;P (/showthread.php?tid=194577)



Small prob again ;P - [SU]Balli - 29.11.2010

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?


Re: Small prob again ;P - PowerPC603 - 29.11.2010

Код:
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.


Re: Small prob again ;P - [SU]Balli - 30.11.2010

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


Re: Small prob again ;P - Lutsen - 30.11.2010

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


Re: Small prob again ;P - [SU]Balli - 30.11.2010

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.


Re: Small prob again ;P - WillyP - 30.11.2010

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



Re: Small prob again ;P - Nero_3D - 30.11.2010

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


Re: Small prob again ;P - WillyP - 30.11.2010

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.


Re: Small prob again ;P - Nero_3D - 30.11.2010

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")


Re: Small prob again ;P - WillyP - 30.11.2010

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?