SA-MP Forums Archive
Locker Help - 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: Locker Help (/showthread.php?tid=603969)



Locker Help - TheMafien - 29.03.2016

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


Re: Locker Help - Mencent - 29.03.2016

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?


Re: Locker Help - TheMafien - 29.03.2016

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 "{"


Re: Locker Help - Mencent - 29.03.2016

Check if you did a mistake when you insert this code.


Re: Locker Help - TheMafien - 29.03.2016

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



Re: Locker Help - OmegaKiller72 - 29.03.2016

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


Re: Locker Help - TheMafien - 29.03.2016

Still Dosent work, Anyone got any ideas?


Re: Locker Help - Golden96 - 29.03.2016

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


Re: Locker Help - TheMafien - 29.03.2016

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;
}



Re: Locker Help - Mencent - 30.03.2016

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;