SA-MP Forums Archive
Need help with ranks! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with ranks! (/showthread.php?tid=431638)



Need help with ranks! - ThaCrypte - 19.04.2013

I need help!
I want to have like a Power system and Rank system for factions. (depending on your power you will have acces to commands)
I want leaders to be able to do: /Adjustrank (player's ID) (Text for rank)
Then it will save in the user's his .INI, and can be used for like /factionchat and /radio and stuff like that.

I am wondering how i can do this? I've been trying for ages and i cant figure it out how to?
Please help! Once i know how to make that i am also able to make a power system myself, i just need to know this.
Currently my /adjustrank cmd =
Код:
CMD:adjustrankname(playerid, params[])
{
	new rank, name[32], string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
	if(sscanf(params, "is[32]", rank, name)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /adjustrankname [rank] [name]");
	switch(rank)
	{
	   case 0:
     {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank0], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 0's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
     }
	    case 1:
	    {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank1], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 1's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    }
	    case 2:
	    {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank2], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 2's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    }
	    case 3:
	    {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank3], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 3's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    }
	    case 4:
	    {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank4], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 4's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    }
	    case 5:
	    {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank5], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 5's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    }
	    case 6:
	    {
	        format(FacInfo[PlayerInfo[playerid][pFac]][fRank6], 32, "%s", name);
	        format(string, sizeof(string), "You have set rank 6's name to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    }
	}
	return 1;
}
I've been trying this:
Код:
CMD:adjustrankname(playerid, params[])
{
	new rank, name[32], string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
	if(sscanf(params, "is[32]", rank, name)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /adjustrankname [rank] [name]");
	switch(rank)
	 {
	        format(PlayerInfo[Playerid[pFac]][pFacRank], 32, "%s", name);
	        format(string, sizeof(string), "You have editted the rankname to %s", name);
	        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

	 }
	return 1;
}



Re: Need help with ranks! - ThaCrypte - 19.04.2013

Error log:
Код:
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14000) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14000) : error 028: invalid subscript (not an array or too many subscripts): "playerid"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14000) : error 029: invalid expression, assumed zero
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14000) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Need help with ranks! - Syntax - 19.04.2013

I'd help you if I knew which is the 14000th line?


Re: Need help with ranks! - ThaCrypte - 19.04.2013

this is the 14000th line:
format(PlayerInfo[Playerid[pFac]][pFacRank], 32, "%s", name);


Re: Need help with ranks! - PaulDinam - 19.04.2013

This part:

pawn Код:
switch(rank)
     {
            format(PlayerInfo[Playerid[pFac]][pFacRank], 32, "%s", name);
            format(string, sizeof(string), "You have editted the rankname to %s", name);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

     }
You do not have a case inside the switch for the rank.


Re: Need help with ranks! - ThaCrypte - 19.04.2013

Код:
CMD:adjustrankname(playerid, params[])
{
	new rank, name[32], string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
	if(sscanf(params, "is[32]", rank, name)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /adjustrankname [rank] [name]");

    {
        format(PlayerInfo[Playerid[pFac]][pFacRank], 32, "%s", params);
        format(string, sizeof(string), "You have editted the rankname to %s", name);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	}

	return 1;
}
This is what i have now, and the errors:
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : error 017: undefined symbol "Playerid"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : warning 215: expression has no effect
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : error 001: expected token: ";", but found "]"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : error 029: invalid expression, assumed zero
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : fatal error 107: too many error messages on one line

Line 14003
Код:
        format(PlayerInfo[Playerid[pFac]][pFacRank], 32, "%s", params);



Re: Need help with ranks! - ThaCrypte - 19.04.2013

Please help, the server is opening saturday night and i would like this to be done :/


Re: Need help with ranks! - BigGroter - 19.04.2013

pawn Код:
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : error 017: undefined symbol "Playerid"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : warning 215: expression has no effect
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : error 001: expected token: ";", but found "]"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : error 029: invalid expression, assumed zero
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003 ) : fatal error 107: too many error messages on one line
The errors are telling you EXACTLY what's wrong.Ё
eg. the first line, you're using Playerid instead of playerid.


Re: Need help with ranks! - Chris_Morrison - 19.04.2013

Playerid, That's makes the error, do it playerid


Re: Need help with ranks! - ThaCrypte - 19.04.2013

Quote:
Originally Posted by Chris_Morrison
Посмотреть сообщение
Playerid, That's makes the error, do it playerid
i did
Код:
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003) : error 028: invalid subscript (not an array or too many subscripts): "playerid"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003) : warning 215: expression has no effect
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003) : error 001: expected token: ";", but found "]"
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003) : error 029: invalid expression, assumed zero
C:\Users\admin\Desktop\AXE\gamemodes\AXE.pwn(14003) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Still these errors on the same line