Jump to content

Comanda CMD


Jimmi

Recommended Posts

Cum ar trebui sa fac comanda pe zCMD?

Stiu ca trebuie sa adaug

CMD:makeadminoff(playerid, params[])
{

dar mai departe?

if(strcmp(cmd, "/makeadminoff", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] > 5)
	        {
	         	new length = strlen(cmdtext);
				while ((idx < length) && (cmdtext[idx] <= ' '))
				{
					idx++;
				}
				new offset = idx;
				new result[128];
				while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
				{
					result[idx - offset] = cmdtext[idx];
					idx++;
				}
				result[idx - offset] = EOS;
				if(!strlen(result))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /makeadminoff [NUMELE-EXACT]");
					return 1;
				}
				new Query[256];
			   	format(Query, sizeof(Query), "SELECT `username` FROM `players` WHERE username = '%s' AND Admin > 0 LIMIT 1", (result));
				mysql_query(string);
				mysql_store_result();
				if(!mysql_num_rows())
				{
			    	format(string, sizeof(string), "Nu este nimeni cu numele %s inregistrat/cu admin!", (result));
					mysql_free_result();
					return SendClientMessage(playerid, 0xEF5C5CFF, string);
				}
				else if(mysql_num_rows() != 0)
				{
				    format(Query, sizeof(Query), "UPDATE `players` SET `Admin` = 0 WHERE username = '%s'", (result));
					mysql_query(string);
					mysql_store_result();
					format(string, sizeof(string), "{0066FF}[Info:] {FFFFFF}%s nu mai este admin!", (result));
					ABroadCast(0xa9c4e4FF, string, 1);
					mysql_free_result();
				}
			}
	    }
	}

 

Link to comment
Share on other sites

CMD:makeadminoff(playerid,params[])
{
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] > 5)
		{
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /makeadminoff [NUMELE-EXACT]");
				return 1;
			}
			new Query[256];
			format(Query, sizeof(Query), "SELECT `username` FROM `players` WHERE username = '%s' AND Admin > 0 LIMIT 1", (result));
			mysql_query(string);
			mysql_store_result();
			if(!mysql_num_rows())
			{
				format(string, sizeof(string), "Nu este nimeni cu numele %s inregistrat/cu admin!", (result));
				mysql_free_result();
				return SendClientMessage(playerid, 0xEF5C5CFF, string);
			}
			else if(mysql_num_rows() != 0)
			{
				format(Query, sizeof(Query), "UPDATE `players` SET `Admin` = 0 WHERE username = '%s'", (result));
				mysql_query(string);
				mysql_store_result();
				format(string, sizeof(string), "{0066FF}[Info:] {FFFFFF}%s nu mai este admin!", (result));
				ABroadCast(0xa9c4e4FF, string, 1);
				mysql_free_result();
			}
		}
	}
	return 1;
}

asa trebuie sa vina.

Link to comment
Share on other sites

Stiu dar trebuie si parametri sscanf ca altfel:

C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(26181) : error 017: undefined symbol "cmdtext"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(26182) : error 017: undefined symbol "idx"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(26182) : error 029: invalid expression, assumed zero
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(26182) : error 029: invalid expression, assumed zero
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(26182) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

 

Edited by jimmi
Link to comment
Share on other sites

  • WopsS locked this topic
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.