SA-MP Forums Archive
Command causes alot of errors - 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)
+--- Thread: Command causes alot of errors (/showthread.php?tid=651003)



Command causes alot of errors - IndependentGaming - 11.03.2018

Hello, I have made a command but did I over see something because it gives me tons of errors

PHP код:
CMD:aduty(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
    if (!
AdminDuty[playerid])
    {
        
PlayerInfo[playerid][pAdminDuty] = 1;
        
SendClientMessageEx(playeridCOLOR_GRAD2"You are now Off-Duty.");
    }
    else
    {
        
PlayerInfo[playerid][pAdminDuty] = 0;
        
SendClientMessageEx(playeridCOLOR_GRAD2"You are now On-Duty.");
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command.");
    }
    return 
1;




Re: Command causes alot of errors - RedFusion - 11.03.2018

What kind of errors? is the compiler giving you errors? warnings? Is it crashing the server?


Re: Command causes alot of errors - IndependentGaming - 11.03.2018

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
What kind of errors? is the compiler giving you errors? warnings? Is it crashing the server?
I is giving me tons of MySQL errors witch doesn't make any sense If I disable the command everything is okay so it is the Aduty command I just made..


Re: Command causes alot of errors - AstroPoid - 11.03.2018

if its not an missed bracket above, try this
Код:
CMD:aduty(playerid, params[])
{
    if(Adminlevelofplayer[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
    	if (!AdminDuty[playerid])
        {
        	PlayerInfo[playerid][pAdminDuty] = 1;
        	SendClientMessageEx(playerid, COLOR_GRAD2, "You are now Off-Duty.");
 	}
    	else
	{
        	PlayerInfo[playerid][pAdminDuty] = 0;
        	SendClientMessageEx(playerid, COLOR_GRAD2, "You are now On-Duty.");
	{
    }
    return 1;
}
And send your errors if that doesn't help you


Re: Command causes alot of errors - IndependentGaming - 11.03.2018

Quote:
Originally Posted by AstroPoid
Посмотреть сообщение
if its not an missed bracket above, try this
Код:
CMD:aduty(playerid, params[])
{
    if(Adminlevelofplayer[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
    	if (!AdminDuty[playerid])
        {
        	PlayerInfo[playerid][pAdminDuty] = 1;
        	SendClientMessageEx(playerid, COLOR_GRAD2, "You are now Off-Duty.");
 	}
    	else
	{
        	PlayerInfo[playerid][pAdminDuty] = 0;
        	SendClientMessageEx(playerid, COLOR_GRAD2, "You are now On-Duty.");
	{
    }
    return 1;
}
And send your errors if that doesn't help you
What is if(Adminlevelofplayer[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");


Re: Command causes alot of errors - AstroPoid - 11.03.2018

Quote:
Originally Posted by SacrificeGaming
Посмотреть сообщение
What is if(Adminlevelofplayer[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
Replace
Код:
Adminlevelofplayer[playerid]
with the code which you are defining admin levels with


Re: Command causes alot of errors - IndependentGaming - 11.03.2018

I must have missed a bracket since it still gives me tons of unnecessary errors