Jump to content

Intrebare ?


VAurel

Recommended Posts

Definesti numele si il adaugi la comenzile respective.

Exemplu:

#define FONDATOR "NumeleTau"
forward Fondatorul(playerid);
public Fondatorul(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		new nume[30]; //Numele tau trebuie sa contina maxim 30 caractere.
        GetPlayerName(playerid, nume, sizeof(nume));
        if((strcmp(nume, FONDATOR, true) == 0))
        {
		    return 1;
		}
	}
	return 0;
}

Apoi inlocuiesti la comenziile respective la care doresti sa ai acces pe acel nume.

Exemplu:

Din
if (PlayerInfo[playerid][pAdmin] >= 6)

Pui 
if (Fondatorul(playerid))

Sau daca vrei si un anumit numar al unui admin de exemplu 6 sa poata folosi comanda si tu la fel sa pui in felul urmator.

if (PlayerInfo[playerid][pAdmin] == 6 || Fondatorul(playerid))

Dar sa nu uiti si de restrictii:

if(!Fondatorul(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Doar fondatorul poate folosi aceasta comanda.");

 

Sper ca te-am ajutat in mare parte.

Edited by razvanduciuc
  • Like 1

Ai nevoie de ajutor in scripting si nu ai bani? Te pot ajuta cu mare drag. Dar asta nu inseamna sa iti lucrez un Sistem de joc complet, daca ai nevoie de ajutor ma poti contacta pe Discord.ezgif-2-3a38433e2465.gif.9283810e304f5e405309769455e5e14b.gif

Link to comment
Share on other sites

La 26.04.2019 la 13:01, razvanduciuc a spus:

Definesti numele si il adaugi la comenzile respective.

Exemplu:


#define FONDATOR "NumeleTau"

forward Fondatorul(playerid);

public Fondatorul(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		new nume[30]; //Numele tau trebuie sa contina maxim 30 caractere.
        GetPlayerName(playerid, nume, sizeof(nume));
        if((strcmp(nume, FONDATOR, true) == 0))
        {
		    return 1;
		}
	}
	return 0;
}

Apoi inlocuiesti la comenziile respective la care doresti sa ai acces pe acel nume.

Exemplu:


Din
if (PlayerInfo[playerid][pAdmin] >= 6)

Pui 
if (Fondatorul(playerid))

Sau daca vrei si un anumit numar al unui admin de exemplu 6 sa poata folosi comanda si tu la fel sa pui in felul urmator.


if (PlayerInfo[playerid][pAdmin] == 6 || Fondatorul(playerid))

Dar sa nu uiti si de restrictii:


if(!Fondatorul(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Doar fondatorul poate folosi aceasta comanda.");

 

Sper ca te-am ajutat in mare parte.

Unde pun restrictia ?

 

Link to comment
Share on other sites

13 hours ago, jumainkain said:

@razvanduciuc Unde pun restrictia ?

CMD:makeadminoff(playerid, params[]){
	new name[25], adminlevel;
	if (Fondatorul(playerid)){
	    if(sscanf(params, "s[25]i", name, adminlevel))return SCM(playerid, COLOR_FADE2, "Syntax: /makeadminoff <name> <level>"); //Restrictia o pui sub comanda aceasta de exemplu.
	    if(!Fondatorul(playerid)) return SCM(playerid, -1, "Only founders can make admin."); //Aceasta este restrictia.
		new query[1000], string[100], escape[200];
		new cont;
		cont = MySQLCheckAccount(name);
		if(cont == 0)return SCM(playerid, -1, "This account don't exist in our DB.");
		new sendername[25];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,name,adminlevel);
		ABroadCast(COLOR_ADMCHAT,string,1);
		HLChat(COLOR_ADMCHAT,string);
		mysql_real_escape_string(string, escape);
		mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `Admin` = '%d' WHERE `name` = '%s'", adminlevel, name);
		mysql_tquery(SQL, query, "", "");
		mysql_format(SQL,query, sizeof(query), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
		mysql_tquery(SQL,query,"","");
	}
	return 1;
}

Ti-am pus mai sus o comanda, ti-am pus si unde sa pui restrictia... Daca ai nevoie de restrictie.. Daca nu ai nevoie, nu o pui!

Sper ca ti-am explicat destul de bine, nu stiu sa ma exprim atat de bine.

Ai nevoie de ajutor in scripting si nu ai bani? Te pot ajuta cu mare drag. Dar asta nu inseamna sa iti lucrez un Sistem de joc complet, daca ai nevoie de ajutor ma poti contacta pe Discord.ezgif-2-3a38433e2465.gif.9283810e304f5e405309769455e5e14b.gif

Link to comment
Share on other sites

Acum 11 ore, razvanduciuc a spus:

CMD:makeadminoff(playerid, params[]){
	new name[25], adminlevel;
	if (Fondatorul(playerid)){
	    if(sscanf(params, "s[25]i", name, adminlevel))return SCM(playerid, COLOR_FADE2, "Syntax: /makeadminoff <name> <level>"); //Restrictia o pui sub comanda aceasta de exemplu.
	    if(!Fondatorul(playerid)) return SCM(playerid, -1, "Only founders can make admin."); //Aceasta este restrictia.
		new query[1000], string[100], escape[200];
		new cont;
		cont = MySQLCheckAccount(name);
		if(cont == 0)return SCM(playerid, -1, "This account don't exist in our DB.");
		new sendername[25];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,name,adminlevel);
		ABroadCast(COLOR_ADMCHAT,string,1);
		HLChat(COLOR_ADMCHAT,string);
		mysql_real_escape_string(string, escape);
		mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `Admin` = '%d' WHERE `name` = '%s'", adminlevel, name);
		mysql_tquery(SQL, query, "", "");
		mysql_format(SQL,query, sizeof(query), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
		mysql_tquery(SQL,query,"","");
	}
	return 1;
}

Ti-am pus mai sus o comanda, ti-am pus si unde sa pui restrictia... Daca ai nevoie de restrictie.. Daca nu ai nevoie, nu o pui!

Sper ca ti-am explicat destul de bine, nu stiu sa ma exprim atat de bine.

Dar comanda setadmin mi-o poti face ? :))

Nu sunt foarte bun la scripting, gen ma descurc la rezolvare buguri si cam tot ce tine de asta, dar nu prea ma descurc sa creez comenzi, mersi :D

 

Link to comment
Share on other sites

On 5/5/2019 at 2:21 PM, jumainkain said:

Dar comanda setadmin mi-o poti face ? :))

Nu sunt foarte bun la scripting, gen ma descurc la rezolvare buguri si cam tot ce tine de asta, dar nu prea ma descurc sa creez comenzi, mersi :D

 

Depinde si de ce GM folosesti, nu iti pot face o comanda de capul meu daca nu stiu ce functii, definitii ai in gm.

Ai nevoie de ajutor in scripting si nu ai bani? Te pot ajuta cu mare drag. Dar asta nu inseamna sa iti lucrez un Sistem de joc complet, daca ai nevoie de ajutor ma poti contacta pe Discord.ezgif-2-3a38433e2465.gif.9283810e304f5e405309769455e5e14b.gif

Link to comment
Share on other sites

  • 2 months later...

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.

×
×
  • 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.