/fine not working
#1

pawn Code:
if(strcmp(cmd, "/fine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] <= 3 || PlayerInfo[playerid][pHelper] <= 4)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            moneys = strvalEx(tmp);
            if(moneys < 1) { SendClientMessage(playerid, COLOR_GREY, "   Fine Money can't be below 1 !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    new length = strlen(cmdtext);
                    while ((idx < length) && (cmdtext[idx] <= ' '))
                    {
                        idx++;
                    }
                    new offset = idx;
                    new result[64];
                    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {
                        result[idx - offset] = cmdtext[idx];
                        idx++;
                    }
                    result[idx - offset] = EOS;
                    if(!strlen(result))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
                        return 1;
                    }
                    if(UseAdmCmdTimer[playerid] > 3)
                    {
                        new IP[16];
                        new year, month, day;
                        getdate(year, month, day);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerIp(playerid, IP, sizeof(IP));
                        format(string, sizeof(string), "%s [%d/%d/%d] Name: %s Key: %s Reason: Spam.", IP, day, month, year,sendername,PlayerInfo[playerid][pKey]);
                        BanLog(string);
                        format(string, sizeof(string), "{AA3333}AdmCmd{FFFF00}: %s was banned, reason: Spam.", sendername);
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        PlayerInfo[playerid][pBand] = 3;
                        PlayerInfo[playerid][pPermBand] = 1;
                        BanEx(playerid, "Banned By: Autoban Reason: Spam");
                       
                        return 1;
                    }
                    PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]-moneys;
                    GivePlayerMoney(giveplayerid,-moneys);
                    format(string, sizeof(string), "{AA3333}AdmCmd{FFFF00}: %s has been fined $%d by an Admin, reason: %s", giveplayer, moneys, (result));
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                    UseAdmCmdTimer[playerid]++;
                    SetTimerEx("UseAdmCmd",3*1000,0,"i",playerid); //3 seconds
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
                return 1;
            }
        }
        return 1;
    }
Reply
#2

Where exactly does it not work? It might be a good idea to tell you...
Reply
#3

Its not working for an admin.im level 99999 its not working>>>working for helpers only
Reply
#4

Try editing this
pawn Code:
if(PlayerInfo[playerid][pAdmin] <= 3 || PlayerInfo[playerid][pHelper] <= 4)
to
pawn Code:
if(PlayerInfo[playerid][pAdmin] < 3 || PlayerInfo[playerid][pHelper] < 4)
Reply
#5

Quote:
Originally Posted by SupremeCommander
View Post
Try editing this
pawn Code:
if(PlayerInfo[playerid][pAdmin] <= 3 || PlayerInfo[playerid][pHelper] <= 4)
to
pawn Code:
if(PlayerInfo[playerid][pAdmin] < 3 || PlayerInfo[playerid][pHelper] < 4)
That's just stupid. Think logic

Your admin level is high enough, BUT your helper level is not! Since you're using "||" it means "or" to call the code down.

pawn Code:
if(PlayerInfo[playerid][pAdmin] <= 3 && PlayerInfo[playerid][pHelper] <= 4)
Use this instead.
Reply
#6

pawn Code:
if(PlayerInfo[playerid][pAdmin] <= 3 && PlayerInfo[playerid][pHelper] <= 4)
Jochemd, if he would use this code, he'd need to be admin level 3 (or higher) AND helper level 4 (or higher) in order to use this command. I don't think that that's what he wanted.
Reply
#7

what does it return when you call it?!
Reply
#8

Quote:
Originally Posted by CookieJar
View Post
pawn Code:
if(PlayerInfo[playerid][pAdmin] <= 3 && PlayerInfo[playerid][pHelper] <= 4)
Jochemd, if he would use this code, he'd need to be admin level 3 (or higher) AND helper level 4 (or higher) in order to use this command. I don't think that that's what he wanted.
He doesn't, if just one of this one is higher it executes like he is admin/helper.
Reply
#9

Quote:
Originally Posted by Jochemd
View Post
He doesn't, if just one of this one is higher it executes like he is admin/helper.
You are stupid.


Anyway, make sure that PlayerInfo[playerid][pAdmin] DOES hold the correct values.
Reply
#10

HTML Code:
if(strcmp(cmd, "/fine", true) == 0)
	{
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 3)
            {
            	SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
				return 1;
			}
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
				return 1;
			}
			moneys = strvalEx(tmp);
			if(moneys < 1) { SendClientMessage(playerid, COLOR_GREY, "   Fine Money can't be below 1 !"); return 1; }
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[64];
					while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
					{
						result[idx - offset] = cmdtext[idx];
						idx++;
					}
					result[idx - offset] = EOS;
					if(!strlen(result))
					{
						SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
						return 1;
					}
					if(UseAdmCmdTimer[playerid] > 3)
					{
					    new IP[16];
					    new year, month, day;
						getdate(year, month, day);
						GetPlayerName(playerid, sendername, sizeof(sendername));
   						GetPlayerIp(playerid, IP, sizeof(IP));
						format(string, sizeof(string), "%s [%d/%d/%d] Name: %s Key: %s Reason: Spam.", IP, day, month, year,sendername,PlayerInfo[playerid][pKey]);
	    				BanLog(string);
	    				format(string, sizeof(string), "AdmCmd: %s was banned by You_Got_Owned, reason: Spam.", sendername);
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[playerid][pBand] = 3;
						PlayerInfo[playerid][pPermBand] = 1;
			    		BanEx(playerid, "Banned By: Autoban Reason: Spam");
			    		
			    		return 1;
					}
					PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]-moneys;
					GivePlayerMoney(giveplayerid,-moneys);
					format(string, sizeof(string), "AdmCmd: %s has been fined $%d by an Admin, reason: %s", giveplayer, moneys, (result));
					SendClientMessageToAll(COLOR_LIGHTRED, string);
					UseAdmCmdTimer[playerid]++;
					SetTimerEx("UseAdmCmd",3*1000,0,"i",playerid); //3 seconds
			    }
			}
            else
			{
  				SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
  				return 1;
			}
        }
        return 1;
	}
Reply
#11

Quote:
Originally Posted by hittt
View Post
You are stupid.
Thank you very much. Though, I am right.
Reply
#12

Quote:
Originally Posted by hittt
View Post
You are stupid.


Anyway, make sure that PlayerInfo[playerid][pAdmin] DOES hold the correct values.
Thanks i'm pretty sure that's not the problem with this command, but since you like to call people stupid and you know everything then you would know the problem revolved around the "||" "&&" issue.

I'm sorry, but are you stupid?
Reply
#13

Quote:
Originally Posted by Steven82
View Post
Thanks i'm pretty sure that's not the problem with this command, but since you like to call people stupid and you know everything then you would know the problem revolved around the "||" "&&" issue.

I'm sorry, but are you stupid?
Thank you.
Reply
#14

Quote:
Originally Posted by Jochemd
View Post
That's just stupid. Think logic

Your admin level is high enough, BUT your helper level is not! Since you're using "||" it means "or" to call the code down.

pawn Code:
if(PlayerInfo[playerid][pAdmin] <= 3 && PlayerInfo[playerid][pHelper] <= 4)
Use this instead.
^^^^
this is correct

However, I personally believe you shouldn't even use it like that but like this

pawn Code:
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 5)
around the entire code....Instead of having an error checking method like that, this way you'd be able to be a helper or an admin with the correct levels...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)