Gamemode in the includes
#1

Hello guys. (english warning..)
I have one problem with a gamemode division. I'm start selecting one base gamemode on the include's ( #include "includes/asd.pwn" ), but im meet with problem in the commands. All enum's, define's, mysql, textdraw etc working, but a few commands doesn't.
The simple commands how a /help, /stats or /clearchat
(+)
work's, but the /setadmin not.. that
(-)
Код:
#include <YSI\y_hooks>
is ready, (main gamemode)
Код:
#include "includes/commands/adminCommands/setadmin.pwn"
too, and here is the .pwn file
Код:
#include <YSI\y_hooks>
CMD:setadmin(playerid, params[])
{
	new playerID, parameter, adminastring[128];
	if(!IsPlayerAdmin(playerid)) return SendErrorMessage(playerid, "Nincs jogosultsбgod a parancs hasznбlatбhoz.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendErrorMessage(playerid, "Nincs jogosultsбgod a parancs hasznбlatбhoz.");
	else if(sscanf(params, "ui", playerID, parameter))
	{
		SendUsageMessage(playerid, "/setadmin [jбtйkos ID VAGY nйv] [szint]");
		SendServerMessage(playerid, "1 = 1*Admin, 2 = 2*Admin, 3 = 3*Admin, 4 = 4*Admin");
		return 1;
	}
	else if(parameter < 0 || parameter > 5) return SendErrorMessage(playerid, "Helytelen paramйterek.");
	else if(!IsPlayerConnected(playerID)) return SendErrorMessage(playerid, "A megadott jбtйkos nem elйrhető.");
	else
	{
		format(adminastring, sizeof(adminastring), "AdmCmd: (%s) megvбltoztatta (%s) admin szintjйt (%i)-re.", ReturnName(playerid), ReturnName(playerID), parameter);
		SendClientMessageToAllEx(COLOR_RED, adminastring);
		format(adminastring, sizeof(adminastring), "Admin szinted megvбltozott. Mostantуl a szinted (%i) (%s)-бttal.", parameter, ReturnName(playerid));
		SendClientMessage(playerID, COLOR_GREEN, adminastring);
		PlayerInfo[playerID][pAdmin] = parameter;
		SaveCharacter(playerid);
	}
	return 1; 
}
Okey i know, my english is killer, and i apologise for this, but maybe someone know help me please?
Reply
#2

Why are you using y_hooks, that's just a command?

Here's an explication; https://sampforum.blast.hk/showthread.php?tid=392061
Reply
#3

For i dont have idea why all command's work just police (faction), and admin commands dont work's, where is the permission.
Reply
#4

Quote:
Originally Posted by Kenton
Посмотреть сообщение
For i dont have idea why all command's work just police (faction), and admin commands dont work's, where is the permission.
Have you tried adding the admin command to the faction commands and check if it'll work? if it doesn't then there's a problem with your command.
Reply
#5

and the problem isn't in the command, i think the problem is on the gamemode and command connection. As otherwise possible that simple /clearchat or anything work's but the admin/faction command's doesn't work's?
Reply
#6

What's the setadmin command returning?


And where, and how have you included all of these, as order is highly important.
Reply
#7

This will work

PHP код:
CMD:setadmin(playeridparams[])
{
    new 
playerIDparameteradminastring[128];
    if(!
IsPlayerAdmin(playerid)) return SendErrorMessage(playerid"Nincs jogosultsбgod a parancs hasznбlatбhoz.");
    if(
PlayerInfo[playerid][pAdmin] < 4) return SendErrorMessage(playerid"Nincs jogosultsбgod a parancs hasznбlatбhoz.");
    if(
sscanf(params"ui"playerIDparameter))
    {
        
SendUsageMessage(playerid"/setadmin [jбtйkos ID VAGY nйv] [szint]");
        
SendServerMessage(playerid"1 = 1*Admin, 2 = 2*Admin, 3 = 3*Admin, 4 = 4*Admin");
        return 
1;
    }
    if(
parameter || parameter 5) return SendErrorMessage(playerid"Helytelen paramйterek.");
    if(!
IsPlayerConnected(playerID)) return SendErrorMessage(playerid"A megadott jбtйkos nem elйrhető.");
    
format(adminastringsizeof(adminastring), "AdmCmd: (%s) megvбltoztatta (%s) admin szintjйt (%i)-re."ReturnName(playerid), ReturnName(playerID), parameter);
    
SendClientMessageToAllEx(COLOR_REDadminastring);
    
format(adminastringsizeof(adminastring), "Admin szinted megvбltozott. Mostantуl a szinted (%i) (%s)-бttal."parameterReturnName(playerid));
    
SendClientMessage(playerIDCOLOR_GREENadminastring);
    
PlayerInfo[playerID][pAdmin] = parameter;
    
SaveCharacter(playerid);
    return 
1

Reply
#8

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
This will work
It won't if what's happening isn't related to the command itself.
Reply
#9

Thanks for your help guys. I’m not now at home, but i’m trying this. Problem is because this isn’t my gamemode, it’s just a downloaded basic, when i’m trying this “selecting” on the includes.
Reply
#10

Hi guys again, im trying a few tip's but nothing. With command's aren't problem, i mean that is gamemode problem. Anything is wrong what i made, but i dont know what. If i look other gamemode's what's selected to "includes" all command's is fine and work, but here not. @****** / @Sew_Sumi / @AlexMSK or someone else
if i send u the gamemode folder with all component's, can u look what is wrong with this?.. Thank you.
Reply
#11

Have you tried making the include path shorter as Y_Less was pointing towards?

Be careful handing out your gamemode to randoms, it's not a wise thing. Are you using git/svn yet?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)