Locker Help
#1

Ok, so Im new to pawno and decided to try to edit The Miami roleplay script but I have a problem, if I am a cop and I type /apdlocker "Police Locker" It says I am not in the faction. The command calls for IsACop but I've seen some variables such as pMember.
The code is as follows

Код:
	if(strcmp(cmdtext, "/apdlocker", true) == 0) // LSPD Locker
	{
	    if(IsPlayerConnected(playerid))
	    {
         if(IsACop(playerid))
			{
			    if(IsPlayerConnected(playerid)//Would ask for a cord but I changed it to see if that was the problem)
			    {
					DisplayDialogForPlayer(playerid, 10);
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GRAD2, "   You are not in your locker room !");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are not a MPD officer!");
    			return 1;
    		}
		}
		return 1;
	}
I don't want any comments such as "WTF are you using that script" "Make your own" etc, In just want help for this. Thanks.
Script I am Using - http://******************/post/19340...rida_Roleplay_[Thug_Life_Edit]/nicholasramdhan/gamemodes/rp
Reply
#2

Hi!

Replace your code with this:
PHP код:
if(strcmp(cmdtext"/apdlocker"true) == 0// LSPD Locker
{
    if(
IsPlayerConnected(playerid))
     {
         
printf("IsACop: %i",IsACop(playerid));
          if(
IsACop(playerid))
        {
              if(
IsPlayerConnected(playerid)//Would ask for a cord but I changed it to see if that was the problem)
            
{
                
DisplayDialogForPlayer(playerid10);
            }
            else
            {
                   
SendClientMessage(playeridCOLOR_GRAD2"   You are not in your locker room !");
                return 
1;
            }
        }
        else
        {
              
SendClientMessage(playeridCOLOR_GREY"   You are not a MPD officer!");
              return 
1;
           }
    }
    return 
1;

Compile the script and restart the server. What is printing in the console (server.log) when you use this command?
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hi!

Replace your code with this:
PHP код:
if(strcmp(cmdtext"/apdlocker"true) == 0// LSPD Locker
{
    if(
IsPlayerConnected(playerid))
     {
         
printf("IsACop: %i",IsACop(playerid));
          if(
IsACop(playerid))
        {
              if(
IsPlayerConnected(playerid)//Would ask for a cord but I changed it to see if that was the problem)
            
{
                
DisplayDialogForPlayer(playerid10);
            }
            else
            {
                   
SendClientMessage(playeridCOLOR_GRAD2"   You are not in your locker room !");
                return 
1;
            }
        }
        else
        {
              
SendClientMessage(playeridCOLOR_GREY"   You are not a MPD officer!");
              return 
1;
           }
    }
    return 
1;

Compile the script and restart the server. What is printing in the console (server.log) when you use this command?
I get this error when compiling
:\Users\Laptop\Downloads\rp\rp\gamemodes\MFRP.pwn( 65641) : error 001: expected token: ")", but found "{"
Reply
#4

Check if you did a mistake when you insert this code.
Reply
#5

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Check if you did a mistake when you insert this code.
It Didn't work and the output from the server_log.txt was this
Код:
[22:25:00] [cmd] [Harry_Peng] /apdlocker
[22:25:00] IsACop: 0
Reply
#6

Forgot '')'', here you go
if(IsPlayerConnected(playerid)) //Would ask for a cord but I changed it to see if that was the problem)
Reply
#7

Still Dosent work, Anyone got any ideas?
Reply
#8

Can you show us the IsACop function? It's probably something to do with that
Reply
#9

Quote:
Originally Posted by Golden96
Посмотреть сообщение
Can you show us the IsACop function? It's probably something to do with that
I think this is it
Код:
stock IsACop(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    /*new leader = PlayerInfo[playerid][pLeader];
	    new member = PlayerInfo[playerid][pMember];
	    if(member == 1 || member == 2 || member == 3 || member == 7) return 1;
		else if(leader == 1 || leader == 2 || leader == 3 || leader == 7) return 1;*/
		new type = FactionInfo[PlayerInfo[playerid][pMember]][FactionType];
		if(type == 1) return 1;
		//else if(type == 2) return 1;
		//else if(type == 5) return 1;
	}
	return 0;
}
Reply
#10

What is printing in the console (server.log)?
PHP код:
stock IsACop(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        
/*new leader = PlayerInfo[playerid][pLeader];
        new member = PlayerInfo[playerid][pMember];
        if(member == 1 || member == 2 || member == 3 || member == 7) return 1;
        else if(leader == 1 || leader == 2 || leader == 3 || leader == 7) return 1;*/
        
new type FactionInfo[PlayerInfo[playerid][pMember]][FactionType];
        
printf("type: %i",FactionInfo[PlayerInfo[playerid][pMember]][FactionType]);
        if(
type == 1) return 1;
        
//else if(type == 2) return 1;
        //else if(type == 5) return 1;
    
}
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)