PDA

View Full Version : PD Question.


PhoeNiX778
13/07/2012, 12:51 PM
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 ...

PhoeNiX778
13/07/2012, 02:18 PM
Can someone help me with sorting this?

Dan.
13/07/2012, 02:21 PM
Try this:

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

PhoeNiX778
13/07/2012, 02:27 PM
Where to put this in the filterscript file?

Dan.
13/07/2012, 02:30 PM
Use this, it's fixed here:

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

PhoeNiX778
13/07/2012, 02:46 PM
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.

clarencecuzz
13/07/2012, 02:49 PM
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.

PhoeNiX778
13/07/2012, 03:09 PM
Now and the members from BSSD, cannot do /gateopen. ? I'm confused

PhoeNiX778
13/07/2012, 03:22 PM
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 :)

PhoeNiX778
13/07/2012, 05:45 PM
Can you help?

Dan.
13/07/2012, 05:47 PM
The thing is, that the enums are in your gamemode and the gate is a filterscript. You should move the gate lines into your gamemode, then it would be a lot easier.