Jump to content
  • 0

Cum fac o verificare in care un player sa poata folosi o comanda doar odata


VenoMarius ERROR404

Question

1 answer to this question

Recommended Posts

  • 0

Exemplu - se reseteaza la relog:

public OnPlayerDisconnect(playerid, reason) {
	SetPVarInt(playerid, "cmd_comanda_folosit", 0);
	return 1;
}
YCMD:comanda(playerid, params[], help) {
	if(GetPVarInt(playerid, "cmd_comanda_folosit") == 1) return SendClientMessage(playerid, -1, "Nu mai poti folosi aceasta comanda.");
	SetPVarInt(playerid, "cmd_comanda_folosit", 1);
	SendClientMessage(playerid, -1, "Nu vei mai putea folosi aceasta comanda pana la urmatorul relog.");
	return 1;
}

 

Dacă vrei să poată folosi acea comanda doar o singură dată indiferent dacă dă relog sau nu, adaugă în baza de date în tabelul conturilor: "cmdComandaUsed" si te poti lua dupa urmatorul exemplu:

YCMD:comanda(playerid, params[], help) {
	if(playerVariables[playerid][pComandaUsed] == 1) return SendClientMessage(playerid, -1, "Nu mai poti folosi aceasta comanda.");
	playerVariables[playerid][pComandaUsed] = 1;
	SendClientMessage(playerid, -1, "Nu vei mai putea folosi aceasta comanda.");

	gQuery[0] = EOS;
	mysql_format(SQL, gQuery, sizeof(gQuery), "update `users` set `cmdComandaUsed` = '1' where `playerID` = '%d'", playerVariables[playerid][pSQLID]);
	mysql_tquery(SQL, gQuery, "", "");
	return 1;
}

Eu am folosit variabilele din gamemode-ul meu, poti adapta foarte usor. Mult succes!

Edited by irinel77
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

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