SA-MP Forums Archive
Help Urgent - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Urgent (/showthread.php?tid=114924)



Help Urgent - CharlieScene - 21.12.2009

Код:
	if(strcmp(cmd, "/rank", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		    tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
		   {
				SendClientMessage(playerid, COLOR_ALLDEPT, "Use /rank [id]");
				return 1;
		   }
		   if (giveplayerid == INVALID_PLAYER_ID)
	    {
		    SendClientMessage(playerid, COLOR_ALLDEPT, "Player is not connected");
		    return 1;
	     }
		   GetPlayerName(playerid, sendername, sizeof(sendername));
		   GetPlayerName(targetid, name, sizeof(name));
		   GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			 if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			 {
          new currank[64];
          new string[128];
          if(PlayerInfo[playerid][pRank] == 1) { currank = "Cadet"; }
          else if(PlayerInfo[playerid][pRank] == 2) { currank = "Officer"; }
          else if(PlayerInfo[playerid][pRank] == 3) { currank = "Senior Officer"; }
          else if(PlayerInfo[playerid][pRank] == 4) { currank = "Sergeant"; }
          else if(PlayerInfo[playerid][pRank] == 5) { currank = "Lieutenant"; }
          else if(PlayerInfo[playerid][pRank] == 6) { currank = "Captain"; }
          else if(PlayerInfo[playerid][pRank] == 7) { currank = "Deputy Chief"; }
          else if(PlayerInfo[playerid][pRank] == 8) { currank = "Chief"; }
          else { currank = "Cadet"; }
          format(string, sizeof(string), "%d SAPD Rank Is %s", targetid, currank);
          SendClientMessage(playerid,COLOR_GREEN1337, string);
				  SendClientMessage(playerid,COLOR_GREEN1337,"Has normal rights when on duty");
          }
	    else
	    {
			  SendClientMessage(playerid, COLOR_ALLDEPT, "You are not a cop");
	    }
		}
		return 1;
	}


What is wronge with this ?


Re: Help Urgent - John Rockie - 21.12.2009

Do you get any errors, if so put them



Re: Help Urgent - CharlieScene - 21.12.2009

Код:
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(6758) : warning 219: local variable "newstate" shadows a variable at a preceding level
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(6758) : warning 219: local variable "oldstate" shadows a variable at a preceding level
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(7885) : warning 204: symbol is assigned a value that is never used: "plname"
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(7884) : warning 204: symbol is assigned a value that is never used: "maxspeed"
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(20964) : error 017: undefined symbol "targetid"
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(20964) : error 017: undefined symbol "name"
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(20964) : error 029: invalid expression, assumed zero
C:\Users\Sam\Desktop\NewScripts\gamemodes\12345678.pwn(20964) : 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: Help Urgent - wafffllesss - 21.12.2009

Quote:
Originally Posted by Aang
Код:
	if(strcmp(cmd, "/rank", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		    tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
		   {
				SendClientMessage(playerid, COLOR_ALLDEPT, "Use /rank [id]");
				return 1;
		   }
		   if (giveplayerid == INVALID_PLAYER_ID)
	    {
		    SendClientMessage(playerid, COLOR_ALLDEPT, "Player is not connected");
		    return 1;
	     }
		   GetPlayerName(playerid, sendername, sizeof(sendername));
		   GetPlayerName(targetid, name, sizeof(name));
		   GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			 if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			 {
          new currank[64];
          new string[128];
          if(PlayerInfo[playerid][pRank] == 1) { currank = "Cadet"; }
          else if(PlayerInfo[playerid][pRank] == 2) { currank = "Officer"; }
          else if(PlayerInfo[playerid][pRank] == 3) { currank = "Senior Officer"; }
          else if(PlayerInfo[playerid][pRank] == 4) { currank = "Sergeant"; }
          else if(PlayerInfo[playerid][pRank] == 5) { currank = "Lieutenant"; }
          else if(PlayerInfo[playerid][pRank] == 6) { currank = "Captain"; }
          else if(PlayerInfo[playerid][pRank] == 7) { currank = "Deputy Chief"; }
          else if(PlayerInfo[playerid][pRank] == 8) { currank = "Chief"; }
          else { currank = "Cadet"; }
          format(string, sizeof(string), "%d SAPD Rank Is %s", targetid, currank);
          SendClientMessage(playerid,COLOR_GREEN1337, string);
				  SendClientMessage(playerid,COLOR_GREEN1337,"Has normal rights when on duty");
          }
	    else
	    {
			  SendClientMessage(playerid, COLOR_ALLDEPT, "You are not a cop");
	    }
		}
		return 1;
	}


What is wronge with this ?
pawn Код:
if(strcmp(cmd, "/rank", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
       tmp = strtok(cmdtext, idx);
           if(!strlen(tmp))
           {
                SendClientMessage(playerid, COLOR_ALLDEPT, "Use /rank [id]");
                return 1;
           }
           new pid = strval(tmp);
           if (!IsPlayerConnected(pid))
       {
            SendClientMessage(playerid, COLOR_ALLDEPT, "Player is not connected");
            return 1;
         }
         new TargetName[MAX_PLAYER_NAME];
           GetPlayerName(playerid, sendername, sizeof(sendername));
           GetPlayerName(pid, TargetName, sizeof(TargetName));
             if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
             {
          new currank[64];
          new string[128];
          if(PlayerInfo[pid][pRank] == 1) { currank = "Cadet"; }
          else if(PlayerInfo[pid][pRank] == 2) { currank = "Officer"; }
          else if(PlayerInfo[pid][pRank] == 3) { currank = "Senior Officer"; }
          else if(PlayerInfo[pid][pRank] == 4) { currank = "Sergeant"; }
          else if(PlayerInfo[pid][pRank] == 5) { currank = "Lieutenant"; }
          else if(PlayerInfo[pid][pRank] == 6) { currank = "Captain"; }
          else if(PlayerInfo[pid][pRank] == 7) { currank = "Deputy Chief"; }
          else if(PlayerInfo[pid][pRank] == 8) { currank = "Chief"; }
          else { currank = "Cadet"; }
          format(string, sizeof(string), "%d SAPD Rank Is %s", pid, currank);
          SendClientMessage(playerid,COLOR_GREEN1337, string);
                  SendClientMessage(playerid,COLOR_GREEN1337,"Has normal rights when on duty");
          }
        else
        {
              SendClientMessage(playerid, COLOR_ALLDEPT, "You are not a cop");
        }
        }
        return 1;
    }
Try this.


Re: Help Urgent - CharlieScene - 21.12.2009

I try it InGame but comes back with this


I type
/rank 1 ( id 1 is me IG )
Says "Player isnt connected"


Re: Help Urgent - wafffllesss - 21.12.2009

Quote:
Originally Posted by Aang
I try it InGame but comes back with this


I type
/rank 1 ( id 1 is me IG )
Says "Player isnt connected"
Copy the code again.. i just edited it


Re: Help Urgent - CharlieScene - 21.12.2009

okay let me try it


Re: Help Urgent - CharlieScene - 21.12.2009

Well it works but , Still isnt working right

When i type in /rank 0

0 SAPD Rank is Cheif
Has normal rights on duty


my id ig is 1 my rank is Cheif

Id 0 rank is Captain ?


Re: Help Urgent - CharlieScene - 21.12.2009

Still nothing ?