/giverank
#1

I cant get this cmd to work, i got error on line 502. I dont know in what way to define it
Код:
(502) : error 017:: undefined symbol "Spelare"
(502) : error 017: undefined symbol "Spelare"
(502) : error 029: invalid expression, assumed zero
Its on " GetPlayerName(playerid, Spelare, sizeof(Spelare)); "

Код:
	if(strcmp(cmd, "/giverank", true) == 0)
	{
	    if(PlayerBase[playerid][pLedare] != 0)
	    {
	        tmp = strtok(cmdtext, idx);
	        if(!strlen(tmp))
	        {
	            SCM(playerid, COLOR_WHITE, "USAGE: /GiveRank <Player ID> <Rank>");
	            return 1;
			}
			new giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			    if(PlayerBase[playerid][pLedare] == PlayerBase[playerid][pLedare] || PlayerBase[giveplayerid][pMedlem] == PlayerBase[playerid][pMedlem])
			    {
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_WHITE, "USAGE: /GiveRank <Player ID> <Rank>");
						return 1;
					}
					new rank = strval(tmp);
     				        GetPlayerName(playerid, Spelare, sizeof(Spelare));
     				        GetPlayerName(giveplayerid, Spelare2, sizeof(Spelare2));
					if(rank <= 5 && rank >= 1)
					{
					    format(Text, sizeof(Text), "** Leader %s gave you rank %d! **", Spelare, rank);
					    SCM(giveplayerid, COLOR_BLUE, Text);
						format(Text, sizeof(Text), "** You gave %s rank %d! **", Spelare2, rank);
						SCM(playerid, COLOR_BLUE, Text);
						PlayerBase[giveplayerid][pRank] = rank;
						UpdateRank(giveplayerid);
					}
					else{SCM(playerid, COLOR_RED, "MAIN ERROR(Ranks are between 1-5!)");}
				}
				else{SCM(playerid, COLOR_RED, "MAIN ERROR(Player does not belong to your faction!)");}
			}
			else{SCM(playerid, COLOR_RED, "MAIN ERROR(That player isn't online!)");}
		}
		else{SCM(playerid, COLOR_RED, "MAIN ERROR(You are not a leader!)");}
		return 1;
	}
Reply
#2

pawn Код:
new Spelare[24],Spelare2[24];
GetPlayerName(playerid, Spelare, sizeof(Spelare));
GetPlayerName(giveplayerid, Spelare2, sizeof(Spelare2));
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new Spelare[24],Spelare2[24];
GetPlayerName(playerid, Spelare, sizeof(Spelare));
GetPlayerName(giveplayerid, Spelare2, sizeof(Spelare2));
Thanks alot!


and is this warning something to care about?
Код:
(491) : warning 219: local variable "giveplayerid" shadows a variable at a preceding level

i got the warning on this
new giveplayerid = ReturnUser(tmp);
Reply
#4

Remove
pawn Код:
new
Reply
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Remove
pawn Код:
new
thanks!

hmm something is wrong, these doesnt work, leader of gang 1 can give leader of gang 2 rank. You can even give gang 2 members rank and 3 etc. how can i fix that?
Код:
					}
					else{SCM(playerid, COLOR_RED, "MAIN ERROR(Ranks are between 1-5!)");}
				}
				else{SCM(playerid, COLOR_RED, "MAIN ERROR(Player does not belong to your faction!)");}
			}
			else{SCM(playerid, COLOR_RED, "MAIN ERROR(That player isn't online!)");}
		}
		else{SCM(playerid, COLOR_RED, "MAIN ERROR(You are not a leader!)");}
		return 1;
	}
#Edit it seams that you have to die before player stats get updated, and sometimes does the cmd blocks of some reason
#Edit 2, you can only give rank to a player who is is a leader and not a member, even when hes is in a other team
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)