SA-MP Forums Archive
/aduty problem - 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: /aduty problem (/showthread.php?tid=277532)



/aduty problem - DannySnoopy - 18.08.2011

well i have a /aduty command it works and all, but i have 2 warnings


Код:
if(!strcmp(cmdtext, "/aduty", true)) // By Ellis
	{
      if(PlayerInfo[playerid][pAdmin] > 1)
		    {
		    	new string[128];
		        if(AdminDuty[playerid] == 0)
		        {
		            AdminDuty[playerid] = 1;
		            SetPlayerArmour(playerid, 999);
					SetPlayerHealth(playerid, 999);
					SetPlayerColor(playerid,COLOR_WHITE);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "[SERVER] {109E0E} Admin %s is now on duty admin",sendername);
					SendClientMessage(playerid, COLOR_WHITE, string);
					return 1;
		        }
		        else if(AdminDuty[playerid] == 1)
		        {
		            AdminDuty[playerid] = 0;
		            SetPlayerArmour(playerid, 0);
					SetPlayerHealth(playerid, 100);
					SetPlayerColor(playerid,0xFF0000AA);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "[SERVER] {FF0000}Admin %s is now off duty admin",sendername);
					SendClientMessage(playerid, COLOR_WHITE, string);
					return 1;
		        }
		    }
		    else
		    {
		        SendClientMessage(playerid, COLOR_WHITE, "   You're not the admin !");
      		  return 1;
		}
	    return 1;
	}
    return 0;
}
and the warnings

C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(212) : warning 217: loose indentation
C:\Documents and Settings\InitialUser\My Documents\Downloads\samp03csvr_R2-2_win32\gamemodes\LVRP.pwn(214) : warning 217: loose indentation

line 217 - is the "}" under "return0;"


Re: /aduty problem - X3nZ - 18.08.2011

If it works, shouldn't worry about the warnings all though they are there for a reason :P

I have the same AoD system as you basically expect mine has a small feature but anyways, I don't get any warnings, I will check my code and see what I can do


Re: /aduty problem - DannySnoopy - 18.08.2011

Quote:
Originally Posted by Disturbed-
Посмотреть сообщение
If it works, shouldn't worry about the warnings all though they are there for a reason :P

I have the same AoD system as you basically expect mine has a small feature but anyways, I don't get any warnings, I will check my code and see what I can do
ok thanks, but you know i don't want
to take any risks.. i mean warning means something


Re: /aduty problem - Kush - 18.08.2011

Quote:
Originally Posted by ThePandaDK
Посмотреть сообщение
ok thanks, but you know i don't want
to take any risks.. i mean warning means something
The warnings are loose indentation. This means you haven't indented your code properly. If you are extremley lazy and unorganized use '#pragma tabsize 0'. Otherwise indent correctly.


Re: /aduty problem - KeeDee - 18.08.2011

AdminDuty[playerid] = 0;
SetPlayerArmour(playerid, 0);
''S''etPlayerHealth(playerid, 999);


See the S? AdminDuty and SetPlayerArmor first letter need to be on the S, Try it.


Re: /aduty problem - ElieJabbour - 18.08.2011

Quote:
Originally Posted by Kush
Посмотреть сообщение
The warnings are loose indentation. This means you haven't indented your code properly. If you are extremley lazy and unorganized use '#pragma tabsize 0'. Otherwise indent correctly.
Yea, But Warnings still shouldn't be ignored..


Re: /aduty problem - Kingunit - 19.08.2011

It's about tabbing. Use the tabs correctly. Try this:
pawn Код:
if(!strcmp(cmdtext, "/aduty", true)) // By Ellis
    {
      if(PlayerInfo[playerid][pAdmin] > 1)
            {
                new string[128];
                if(AdminDuty[playerid] == 0)
                {
                    AdminDuty[playerid] = 1;
                    SetPlayerArmour(playerid, 999);
                    SetPlayerHealth(playerid, 999);
                    SetPlayerColor(playerid,COLOR_WHITE);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[SERVER] {109E0E} Admin %s is now on duty admin",sendername);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else if(AdminDuty[playerid] == 1)
                {
                    AdminDuty[playerid] = 0;
                    SetPlayerArmour(playerid, 0);
                    SetPlayerHealth(playerid, 100);
                    SetPlayerColor(playerid,0xFF0000AA);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[SERVER] {FF0000}Admin %s is now off duty admin",sendername);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "   You're not the admin !");
            return 1;
        }
        return 1;
    }
    return 0;
}