Mecanicul Posted September 9, 2021 Posted September 9, 2021 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 ])
Banditul Posted September 10, 2021 Posted September 10, 2021 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 }
Mecanicul Posted September 10, 2021 Author Posted September 10, 2021 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!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now