Jump to content

check


Mecanicul

Recommended Posts

stock checkadmin(level)
{
    foreach(new x : Player)
    {
        if(PlayerInfo[playerid][pAdmin] < level) 
        {
            SCM(x, COLOR_LIGHTGREEN3, "You are not allowed to use this command.");
        }
    }
    return true;
}
Vreau sa fac un stock pentru verificarea admin sa nu scriu de fiecare data la comanda if(playerInfo[playerid][pAdmin] < 6) return SCM etc etc

 

vreau sa imi fie mai usor, stock-ul merge, tu ca player nu merge sa folosesti comanda, dar imi arata mesajul, dar si sintaxa.

Daca vreau sa folosesc /a salut, imi apare doar mesajul, si daca scriu doar /a imi arata si mesajul si sintaxa (syntax: /a [ message ])

 

Link to comment
Share on other sites

Eventual poti face asa desi depinde cum ti-ai facut if-urile in comanda nu pot garanta ca nu iti va mai aparea si mesajul de sintaxa

CheckAdmin(playerid, level)
{
	if(PlayerInfo[playerid][pAdmin] < level) 
    {
		return SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You are not allowed to use this command.");
    }
}

Eventual poti citi mai multe despre ce face foreach aici: https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Data/y_iterate.md pentru ca nu ai nevoie de el in ce  voiai sa faci absolut deloc

Ti-as sugera eventual o alta posibila abordare ca sa iti scoata eventual in evidenta exact ce cod va fi executat si unde se va opri

IsPlayerAdminOfLevel(playerid, level)
{
	return PlayerInfo[playerid][pAdmin] < level;
}

Si o poti folosi

CMD:comanda(playerid, params[])
{
	if (IsPlayerAdminOfLevel(playerid, level) == false)
		return SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You are not allowed to use this command.");

	// Restul de cod
}

 

Link to comment
Share on other sites

1 hour ago, Banditul said:

Eventual poti face asa desi depinde cum ti-ai facut if-urile in comanda nu pot garanta ca nu iti va mai aparea si mesajul de sintaxa

CheckAdmin(playerid, level)
{
	if(PlayerInfo[playerid][pAdmin] < level) 
    {
		return SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You are not allowed to use this command.");
    }
}

Eventual poti citi mai multe despre ce face foreach aici: https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Data/y_iterate.md pentru ca nu ai nevoie de el in ce  voiai sa faci absolut deloc

Ti-as sugera eventual o alta posibila abordare ca sa iti scoata eventual in evidenta exact ce cod va fi executat si unde se va opri

IsPlayerAdminOfLevel(playerid, level)
{
	return PlayerInfo[playerid][pAdmin] < level;
}

Si o poti folosi

CMD:comanda(playerid, params[])
{
	if (IsPlayerAdminOfLevel(playerid, level) == false)
		return SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You are not allowed to use this command.");

	// Restul de cod
}

 

Multumesc! Am inteles ce mi-ai explicat tu acolo! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.