SA-MP Forums Archive
Cant use command - 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: Cant use command (/showthread.php?tid=574552)



Cant use command - dundolina - 18.05.2015

Hello i have command and i have the level of admin to use it but still give me the text message that i dont have premission to use this command. What is the problem?

Код:
	if(strcmp(cmd, "/refuelcars", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] >= 5)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "Нямаш достатъчно права, за да използваш командата!");
			    return 1;
			}
			else
			{
				for(new cars=0; cars<MAX_VEHICLES; cars++)
				{
					if(!VehicleOccupied(cars))
					{
    fuel[cars] = fuel[cars] = 100; //restoring fuel to 100
    isrefuelling[playerid] = 0;//resetting anti-spam thingy :3
					}
				}
                format(string, sizeof(string), "%s зареди всички коли!", PlayerName(playerid));
	            SendClientMessageToAll(COLOR_GRAD1,string);
			}
		}
		return 1;
	}



Re: Cant use command - Konstantinos - 18.05.2015

Change to:
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 5)



Re: Cant use command - StR_MaRy - 18.05.2015

Quote:

if(strcmp(cmd, "/refuelcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
else
{
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
if(!VehicleOccupied(cars))
{
fuel[cars] = fuel[cars] = 100; //restoring fuel to 100
isrefuelling[playerid] = 0;//resetting anti-spam thingy :3
}
}
format(string, sizeof(string), "%s зa?aдe вneчee eолe!", PlayerName(playerid));
SendClientMessageToAll(COLOR_GRAD1,string);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Нyiao доnoaoъчно i?aвa, зa дa eзiолзвao eоiaндaoa!");
return 1;
}
}
return 1;
}

try this


Re: Cant use command - aCloudy - 18.05.2015

Actually, There is no need for using "IsPlayerConnected(playerid)", Because we cannot use commands when we are offline ...
Use this:
pawn Код:
if(strcmp(cmd, "/refuelcars", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] < 5)
    {
        else
        {
            for(new cars=0; cars<MAX_VEHICLES; cars++)
            {
                if(!VehicleOccupied(cars))
                {
                    fuel[cars] = fuel[cars] = 100; //restoring fuel to 100
                    isrefuelling[playerid] = 0;//resetting anti-spam thingy :3
                }
            }
            format(string, sizeof(string), "%s зa?aдe вneчee eолe!", PlayerName(playerid));
            SendClientMessageToAll(COLOR_GRAD1,string);
            }
        }
    }
    return 1;
}



Re: Cant use command - Yashas - 19.05.2015

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 5)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Нямаш достатъчно права, за да използваш командата!");
                return 1;
            }
Do you know what this code does?It tells that you are not an admin if you are an admin level 5+.Any player who isn't an admin or has an admin level lower than 5 will be able to use this command.

The fix is change the => 5 operator to < 5.