SA-MP Forums Archive
PD Question. - 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: PD Question. (/showthread.php?tid=359233)



PD Question. - PhoeNiX778 - 13.07.2012

Hello guys. I've made a filterscript that makes me a PD gate. Now I want to allow only PD officers to use it.
Here is the the Faction strict:
Код:
if (PlayerInfo[playerid][pMember] == 6)
Here is my filterscript file:
Код:
#include <a_samp>
#define dgate_1 1
#define ownermsg1 2
new gate;
public OnFilterScriptInit()
{
	gate = CreateObject(976,-2275.8000488281, 2348.8000488281, 3.7999999523163, 0.0, 0.0, 56);
	//Add this on the top of the scrip below the defines
	// new gate;
	//then add
	// gate = your object
} //

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/gateopen", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, dgate_1, DIALOG_STYLE_LIST, "Dialog Gate Options", "Open Gate \nClose Gate \nHouse Owner \n Teleport", "          Choose Option       ", "");
		return 1;
	}
	return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==dgate_1)
{
        if(response)
        {
            if(listitem == 0)//Open Gate
            
            {
                MoveObject(gate,-2275.8000488281, 2348.8000488281, 0.3999999523163 ,0.50);
            }
            if(listitem == 1)//Close Gate
            {
                MoveObject(gate,-2275.8000488281, 2348.8000488281, 3.7999999523163,0.50);
            }
            if(listitem == 2) //Owner Info Opention
            {
                ShowPlayerDialog(playerid, ownermsg1, DIALOG_STYLE_MSGBOX, "Notice", "Name: \n Job: \n Staff Member:", "Okay", "Then");
            }
            if(listitem == 3)//Teleport Option
            {
                SetPlayerInterior (playerid, 0);
                SetPlayerPos(playerid, 1497.2285, -707.8083, 98.0334 );
            }

        }
        return 1;
    }
return 0;
}
It is Dialog. If it is not able to be made on the filterscript I was thinking about inserting something in the gamemode that check the faction, and if it is ok, allow to use the cmd, if not SendClientMessage ...


Re: PD Question. - PhoeNiX778 - 13.07.2012

Can someone help me with sorting this?


Re: PD Question. - Dan. - 13.07.2012

Try this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(PlayerInfo[playerid][pMember] == 6)
    {
        if (strcmp("/gateopen", cmdtext, true, 10) == 0)
        {
            ShowPlayerDialog(playerid, dgate_1, DIALOG_STYLE_LIST, "Dialog Gate Options", "Open Gate \nClose Gate \nHouse Owner \n Teleport", "          Choose Option       ", "");
            return 1;
        }
    }
    else return SendClientMessage(playerid, FFFFFF, "You are not a PD Officer!");
    return 0;
}



Re: PD Question. - PhoeNiX778 - 13.07.2012

Where to put this in the filterscript file?


Re: PD Question. - Dan. - 13.07.2012

Use this, it's fixed here:

pawn Код:
#include <a_samp>
#define dgate_1 1
#define ownermsg1 2
new gate;
public OnFilterScriptInit()
{
    gate = CreateObject(976,-2275.8000488281, 2348.8000488281, 3.7999999523163, 0.0, 0.0, 56);
    //Add this on the top of the scrip below the defines
    // new gate;
    //then add
    // gate = your object
} //

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gateopen", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pMember] == 6)
        {
            ShowPlayerDialog(playerid, dgate_1, DIALOG_STYLE_LIST, "Dialog Gate Options", "Open Gate \nClose Gate \nHouse Owner \n Teleport", "          Choose Option       ", "");
            return 1;
        }
        else return SendClientMessage(playerid, FFFFFF, "You are not a PD Officer!");
    }
    return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==dgate_1)
{
        if(response)
        {
            if(listitem == 0)//Open Gate
           
            {
                MoveObject(gate,-2275.8000488281, 2348.8000488281, 0.3999999523163 ,0.50);
            }
            if(listitem == 1)//Close Gate
            {
                MoveObject(gate,-2275.8000488281, 2348.8000488281, 3.7999999523163,0.50);
            }
            if(listitem == 2) //Owner Info Opention
            {
                ShowPlayerDialog(playerid, ownermsg1, DIALOG_STYLE_MSGBOX, "Notice", "Name: \n Job: \n Staff Member:", "Okay", "Then");
            }
            if(listitem == 3)//Teleport Option
            {
                SetPlayerInterior (playerid, 0);
                SetPlayerPos(playerid, 1497.2285, -707.8083, 98.0334 );
            }

        }
        return 1;
    }
return 0;
}



Re: PD Question. - PhoeNiX778 - 13.07.2012

Errors:
All of them are on line 18:
1. undefined symbol "PlayerInfo"
2. expression has no effect
3. unexpected token ";", but found "]"
4. invalid expression, assumed zero
5. fatar error 107: too many error messages on one line.

Script:
Код:
#include <a_samp>
#define dgate_1 1
#define ownermsg1 2
new gate;
public OnFilterScriptInit()
{
    gate = CreateObject(976,-2275.8000488281, 2348.8000488281, 3.7999999523163, 0.0, 0.0, 56);
    //Add this on the top of the scrip below the defines
    // new gate;
    //then add
    // gate = your object
} //

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gateopen", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pMember] == 6)
        {
            ShowPlayerDialog(playerid, dgate_1, DIALOG_STYLE_LIST, "Dialog Gate Options", "Open Gate \nClose Gate \nHouse Owner \n Teleport", "          Choose Option       ", "");
            return 1;
        }
        else return SendClientMessage(playerid, FFFFFF, "You are not a PD Officer!");
    }
    return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==dgate_1)
{
        if(response)
        {
            if(listitem == 0)//Open Gate

            {
                MoveObject(gate,-2275.8000488281, 2348.8000488281, 0.3999999523163 ,0.50);
            }
            if(listitem == 1)//Close Gate
            {
                MoveObject(gate,-2275.8000488281, 2348.8000488281, 3.7999999523163,0.50);
            }
            if(listitem == 2) //Owner Info Opention
            {
                ShowPlayerDialog(playerid, ownermsg1, DIALOG_STYLE_MSGBOX, "Notice", "Name: \n Job: \n Staff Member:", "Okay", "Then");
            }
            if(listitem == 3)//Teleport Option
            {
                SetPlayerInterior (playerid, 0);
                SetPlayerPos(playerid, 1497.2285, -707.8083, 98.0334 );
            }

        }
        return 1;
    }
return 0;
}
Line 18 is red colored.


Re: PD Question. - clarencecuzz - 13.07.2012

pawn Код:
enum pInfo
{
pMember,
};

new PlayerInfo[MAX_PLAYERS][pInfo];
EDIT:
If you're going to add this script back into the gamemode, it is recommended you remove these lines.


Re: PD Question. - PhoeNiX778 - 13.07.2012

Now and the members from BSSD, cannot do /gateopen. ? I'm confused


Re: PD Question. - PhoeNiX778 - 13.07.2012

Isn't is possible to be made a command like /giveremote, and maybe the command will change a line in the player's .ini file, like pdremote - to 0 or 1. If 0 cannot use the cmd, if 1 can use the cmd. Idk if it is harder to be made. I'll be very happy if you can help me with this


Re: PD Question. - PhoeNiX778 - 13.07.2012

Can you help?