Command not working
#1

Код:
if(strcmp(cmd, "/setleader", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Function: {FFFFFF}/setleader [ID or Name/Part of name] [Number(1-8)]");
				return 1;
			}
			new playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			new level = strval(tmp);
			if(level < 1 || level > 8) { SendClientMessage(playerid, COLOR_GREY, "Function: {FFFFFF}/From [1-8]"); return 1; }
			if (PlayerInfo[playerid][pAdmin] >= 1337)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			            if(PlayerInfo[playa][pMember] > 0)
			            {
			                SendClientMessage(playerid, COLOR_GREY, "That player is in a Faction");
			                return 1;
			            }
						GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[playa][pLeader] = level;
						PlayerInfo[playa][pMember] = level;
						format(string, sizeof(string), "You Are Now A Faction Leader by Admin %s", sendername);
						SendClientMessage(playa, COLOR_LIGHTRED, string);
						format(string, sizeof(string), "You have given %s control to run Faction Number %d", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						if(level == 1) { PlayerInfo[playa][pChar] = 288; PlayerInfo[playa][pRank] = 8; } //Police Force
						else if(level == 2) { PlayerInfo[playa][pChar] = 286; PlayerInfo[playa][pRank] = 8; } //FBI/ATF
						else if(level == 3) { PlayerInfo[playa][pChar] = 186; PlayerInfo[playa][pRank] = 8; } //Triads
						else if(level == 4) { PlayerInfo[playa][pChar] = 111; PlayerInfo[playa][pRank] = 8; } //Bonanno
						else if(level == 5) { PlayerInfo[playa][pChar] = 113; PlayerInfo[playa][pRank] = 8; } //Salvatore
						else if(level == 6) { PlayerInfo[playa][pChar] = 294; PlayerInfo[playa][pRank] = 8; } //Hitmans
						else if(level == 7) { PlayerInfo[playa][pChar] = 61; PlayerInfo[playa][pRank] = 8; } //Taxi Cab Company
						else if(level == 8) { PlayerInfo[playa][pChar] = 107; PlayerInfo[playa][pRank] = 8; } //424JF Gang
					    SetPlayerSkin(playa, PlayerInfo[playa][pChar]);
					    UpdatePlayerInfo(playa);
					    SetPlayerSpawn(playa);
					}
				}//not connected
			}
		}
		return 1;
	}
Nothing happens if I type in the ID and the id of the faction
Reply
#2

Help please?
Reply
#3

someone please.. atleast re-write it to work..
Reply
#4

use mine command with zcmd and sscanf
Код:
CMD:makeleader(playerid,params[])
{
	new string[128], igrac, giveplayerid, giveplayer[MAX_PLAYER_NAME], level, sendername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sendername, sizeof(sendername));
    if(IsPlayerAdmin(playerid))
	{
		if(!sscanf(params, "ui", giveplayerid, level))
		{
		    PlayerInfo[igrac][pRank] = 6;
		    PlayerInfo[igrac][pMember] = 0;
			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"Pogresan igracev id");
			PlayerInfo[giveplayerid][pLeader] = level;
			format(string, sizeof(string), "Dao si igracu %s lidera organizacije %i", giveplayer, level);
			SendClientMessage(playerid, -1, string);
			format(string, sizeof(string), "Admin %s ti je dao lidera organizacije %i", sendername, level);
			SendClientMessage(giveplayerid, -1, string);
			if(level == 0) { PlayerInfo[giveplayerid][pSkin] = 0; PlayerInfo[giveplayerid][pRank] = 0; return 1; }
			else if(level == 1) { PlayerInfo[giveplayerid][pSkin] = 288; } //Policija
			SetPlayerSkin(giveplayerid,PlayerInfo[giveplayerid][pSkin]);
		}
		else SendClientMessage(playerid, -1,"Koristenje /makeleader [IDigraca/Dio imena] [broj(1-2)]");
	}
	else SendClientMessage(playerid, -1,"Niste ovlasteni da koristite ovu komandu");
	return 1;
}
edit this where is something not on english to you want
Reply
#5

Are you sure your admin level is 1337 or higher?

pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 1337)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)