SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/08/2018, 11:34 PM   #1
homelessdrop
Little Clucker
 
homelessdrop's Avatar
 
Join Date: Jan 2016
Posts: 41
Reputation: 17
Default Gamemode in the includes

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
(-)
Code:
#include <YSI\y_hooks>
is ready, (main gamemode)
Code:
#include "includes/commands/adminCommands/setadmin.pwn"
too, and here is the .pwn file
Code:
#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?

Last edited by homelessdrop; 16/08/2018 at 09:19 AM.
homelessdrop is online now   Reply With Quote
Old 14/08/2018, 11:58 PM   #2
AlexMSK
Banned
 
Join Date: Apr 2016
Location: Albania, yez
Posts: 203
Reputation: 61
Default Re: Gamemode in the includes

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

Here's an explication; http://forum.sa-mp.com/showthread.php?t=392061
AlexMSK is offline   Reply With Quote
Old 15/08/2018, 12:08 AM   #3
homelessdrop
Little Clucker
 
homelessdrop's Avatar
 
Join Date: Jan 2016
Posts: 41
Reputation: 17
Default Re: Gamemode in the includes

For i dont have idea why all command's work just police (faction), and admin commands dont work's, where is the permission.
homelessdrop is online now   Reply With Quote
Old 15/08/2018, 12:12 AM   #4
AlexMSK
Banned
 
Join Date: Apr 2016
Location: Albania, yez
Posts: 203
Reputation: 61
Default Re: Gamemode in the includes

Quote:
Originally Posted by Kenton View Post
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.
AlexMSK is offline   Reply With Quote
Old 15/08/2018, 12:40 AM   #5
homelessdrop
Little Clucker
 
homelessdrop's Avatar
 
Join Date: Jan 2016
Posts: 41
Reputation: 17
Default Re: Gamemode in the includes

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?

Last edited by homelessdrop; 16/08/2018 at 09:23 AM.
homelessdrop is online now   Reply With Quote
Old 15/08/2018, 02:10 AM   #6
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,269
Reputation: 525
Default Re: Gamemode in the includes

What's the setadmin command returning?


And where, and how have you included all of these, as order is highly important.
Sew_Sumi is offline   Reply With Quote
Old 15/08/2018, 08:53 AM   #7
AlexMSK
Banned
 
Join Date: Apr 2016
Location: Albania, yez
Posts: 203
Reputation: 61
Default Re: Gamemode in the includes

This will work

PHP Code:
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

AlexMSK is offline   Reply With Quote
Old 15/08/2018, 09:07 PM   #8
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,269
Reputation: 525
Default Re: Gamemode in the includes

Quote:
Originally Posted by AlexMSK View Post
This will work
It won't if what's happening isn't related to the command itself.
Sew_Sumi is offline   Reply With Quote
Old 16/08/2018, 08:59 AM   #9
homelessdrop
Little Clucker
 
homelessdrop's Avatar
 
Join Date: Jan 2016
Posts: 41
Reputation: 17
Default Re: Gamemode in the includes

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.
homelessdrop is online now   Reply With Quote
Old 17/08/2018, 03:18 PM   #10
homelessdrop
Little Clucker
 
homelessdrop's Avatar
 
Join Date: Jan 2016
Posts: 41
Reputation: 17
Default Re: Gamemode in the includes

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.
homelessdrop is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to divide gamemode in INCLUDES? div Scripting Help 19 29/06/2018 10:37 PM
Gamemode based in includes Whillyrez Discussion 10 08/02/2017 02:23 PM


All times are GMT. The time now is 07:58 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.