Jump to content
  • 0

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


Question

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.