Commands wont work
#1

Hello,i tried to make an command with you can promote any user if you are RCON admin,but if i write /promote 0,it wont work,nothing wont show up

heres the code

Код:
	if(strcmp(cmdtext, "/promote", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{

	new tmp[32];

	if(!strlen(tmp))
	{
	SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /promote [playerid/PartOfName]");
	return 1;
	}

	new string[256];
	new para1;
	para1 = strval(tmp);
  new giveplayer[MAX_PLAYER_NAME];
 	new sendername[MAX_PLAYER_NAME];
	GetPlayerName(para1, giveplayer, sizeof(giveplayer));
	GetPlayerName(playerid, sendername, sizeof(sendername));
	if(IsPlayerConnected(para1))
	{
	if(IsPlayerAdmin(playerid))
	{
	format(string, sizeof(string), " You have promoted %s to Principal.", giveplayer);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	PlayerInfo[playerid][fLeader] = 1;
	SetPlayerSkin(playerid,295);
	}
	}
	else
	{
	SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command(leaders only)!");
	}
	}
	return 1;
	}
Reply
#2

You have forgotten "tmp = strtok(...)" or something like that, I don't know what functions do you use
Reply
#3

tried something,got 1 error
Код:
C:\Documents and Settings\xx\Desktop\Uus kaust (5)\gamemodes\sadsa.pwn(876) : error 029: invalid expression, assumed zero
Код:
	if(strcmp(cmd, "/promote", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{
	new giveplayer[MAX_PLAYER_NAME];
	new tmp[256];
	new idx;
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp))
	{
	SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /promote [playerid/PartOfName]");
	return 1;
	}
	new para1;
	para1 = strval(tmp);
	if(IsPlayerConnected(para1))
	{
	if(IsPlayerAdmin(playerid))
	{
	new string[256];
	format(string, sizeof(string), " You have promoted %s to Principal.", giveplayer);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	PlayerInfo[playerid][fLeader] = 1;
	SetPlayerSkin(playerid,295);
	}
	}
	else
	{
	SendClientMessage(para1, COLOR_YELLOW, "Error: You are not connected yet!!");
	}
line 876	else
	{
	SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
	}

 	}
	return 1;
	}
EDIT:FIXED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)