Jump to content

Sistem admin


Recommended Posts

Re. E foarte simplu sa faci acest lucrul doar ca uni dintre cei noi in scripting nu stiu cum. e a

Primadata mergem la enum pInfo sau cum aveti voi.

enum pInfo {
	// Ce aveti voi, 

Acum, mergem la OnLogin sau OnPlayerLogin depinde cum aveti voi in gamemode. Inainte de SpawnPlayer(playerid); puneti 

PlayerInfo[playerid][pAdmin] = cache_get_field_content_int(0, "Admin");

Acum trebuie sa facem comanda cu care adminul va oferi admin.

CMD:setadmin(playerid, params[])
	if(PlayerInfo[playerid][pAdmin] < 6)
		return SendClientMessage(playerid, 0xB1BFCC80, "Eroare: Nu ai gradul administrativ necesar.");
	new id, admin, string[64];
	if(sscanf(params, "ud", id, admin))
		return SendClientMessage(playerid, 0xB1BFCC80, "SYNTAX: /setadmin <ID/Name> <Admin Level (0-7)>");
	if(admin < 0 || admin > 7)
		return SendClientMessage(playerid, -1, "Invalid Admin Level.");
	format(string, sizeof(string), "Felicitari! Ai fost promovat la admin %d.", admin);
	SendClientMessage(id, -1, string);
	new query[100];
	PlayerInfo[playerid][pAdmin] = admin;
	mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `Admin` = '%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pSQLID]);
	mysql_tquery(SQL, query);
	return 1;

In loc de PlayerInfo puneti cum aveti voi. De ex P_Data... la `users` cum aveti voi tabelul in baza de date unde se salveaza conturile.

Acum, intram in baza de date. (localhost/phpmyadmin).



Dupa ce ati intrat in baza de date apasati pe Structure.

Dupa aceea mai jos faceti o coloana.




Ceva de genul trebuie sa arate coloana. Acum dam pe Save si suntem gata!

Sper ca celor incepatori le-a fost de ajutor. pa

Link to comment
Share on other sites

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

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.