Jump to content
  • 0

Nu schimba valoarea in baza de date[/makeadmin]


DreiVian

Question

Am facut singur o comanda /makeadmin si nu reusesc sa o fac sa imi schimbe valoarea in baza de date la gradul de admin

CMD:makeadmin(playerid, params[])
{
	new TNume[MAX_PLAYER_NAME], PT, alvl, query[80], string[84];
	GetName(playerid);
	GetPlayerName(PT,TNume, sizeof(TNume));
	if(sscanf(params,"ui",TNume,alvl)) return SendClientMessage(playerid,0xffffff,"Foloseste: /makeadmin [ID][1-5]");
	if(P_Data[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0xFFFFFF, "Nu esti admin sau nu ai gradul potrivit");
	P_Data[PT][pAdmin] = alvl;
	format(string, sizeof(string), "Ai fost promovat ca si Administrator Level %d admin by %s", alvl, GetName(playerid));
	SendClientMessage(PT, 0xffffff, string);
	format(string, sizeof(string), "Ai dat admin %d lui %i", alvl, PT);
	SendClientMessage(playerid, 0xffffff, string);
	mysql_format(handle, query, sizeof(query), "UPDATE `conturi` SET `pAdmin`='%i' WHERE `Nume`='%e'", P_Data[PT][pAdmin],TNume);
 	mysql_query(handle, query);
 	
	return 1;
}

Poate careva sa ma ajute ? Nu stiu mai de loc mysql deci cum as putea schimba cu o comanda valorile din baza de date ? 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

incearca sa modifici asta 

    mysql_format(handle, query, sizeof(query), "UPDATE `conturi` SET `pAdmin`='%d WHERE `Nume`='%s'", P_Data[PT][pAdmin],TNume);

in asta, mai mult ca sigur ai gresit la variabila ai un p trebuie sters

    mysql_format(handle, query, sizeof(query), "UPDATE `conturi` SET `Admin`='%d WHERE `Nume`='%s'", P_Data[PT][pAdmin],TNume);
   

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 1
CMD:makeadmin(playerid, params[])
{
    new TNume[MAX_PLAYER_NAME], PT, alvl, query[80], string[84];
    GetName(playerid);
    GetPlayerName(PT,TNume, sizeof(TNume));
    if(sscanf(params,"ui",TNume,alvl)) return SendClientMessage(playerid,0xffffff,"Foloseste: /makeadmin [ID][1-5]");
    if(P_Data[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0xFFFFFF, "Nu esti admin sau nu ai gradul potrivit");
    P_Data[PT][pAdmin] = alvl;
    format(string, sizeof(string), "Ai fost promovat ca si Administrator Level %d admin by %s", alvl, GetName(playerid));
    SendClientMessage(PT, 0xffffff, string);
    format(string, sizeof(string), "Ai dat admin %d lui %i", alvl, PT);
    SendClientMessage(playerid, 0xffffff, string);
    mysql_format(handle, query, sizeof(query), "UPDATE `conturi` SET `pAdmin`='%d WHERE `Nume`='%s'", P_Data[PT][pAdmin],TNume);
    mysql_query(handle, query);
    return 1;
}

incearca asa

Link to comment
Share on other sites

  • 0

Te asiguri ca ai facut corect baza de date sau ai introdus acea structura.

Daca ai facut conexiunea bine si structura e in baza poti incerca: ...

Folosesti 'mysql_tquery' in loc de 'mysql_query', nu garantez deoarece nu stiu foarte bine aceste lucruri.

Inca o greseala este ca la sscanf ai folosit 'TName' si nu 'PT'. GetPlayerName de preferat il pui sub sscanf.

Edited by DanielE
Link to comment
Share on other sites

  • 0
13 minutes ago, DanielE said:

Te asiguri ca ai facut corect baza de date sau ai introdus acea structura.

Daca ai facut conexiunea bine si structura e in baza poti incerca: ...

Folosesti 'mysql_tquery' in loc de 'mysql_query', nu garantez deoarece nu stiu foarte bine aceste lucruri.

Inca o greseala este ca la sscanf ai folosit 'TName' si nu 'PT'. GetPlayerName de preferat il pui sub sscanf.

Am facut ce mi-ai zis si tot nu modifica in baza de date valoarea lui Admin.

Multumesc pentru raspuns

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.