Cant use command
#1

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;
	}
Reply
#2

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

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
Reply
#4

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;
}
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)