Moving gates problem 3 ! -
Kirchhoff - 06.04.2010
Hi i want to make that only the cops team can open LSPD gates this is my filter script :
The guy who wants to open the gate must have rank 1 . So i want to make the gates that it will only open if you have rank 1
P.S : oh and another problem ! The //lspd objects spawn imediatly i mean if you hit that object there are many more of them in the same place , so you can destroy the fence because there are 100 or more in the same place . How to fix that please help !
Код:
#include <a_samp>
#pragma tabsize 0
new lpgate;
#define COLOR_YELLOW 0xFFFF00AA
public OnFilterScriptInit ()
{
lpgate = CreateObject(975,1548.571,-1627.423,14.058,0.0,0.0,90.000);
return 1;
}
public OnPlayerCommandText (playerid, cmdtext[])
{
if (strcmp(cmdtext, "/lspdopen", true) == 0)
{
MoveObject(lpgate, 1548.571,-1634.002,14.058,3);
SendClientMessage(playerid, COLOR_YELLOW,"Welcome to LSPD!");
return 1;
}
if (strcmp(cmdtext, "/lspdclose", true) == 0)
{
MoveObject(lpgate, 1548.571,-1627.423,14.058,3);
SendClientMessage(playerid, COLOR_YELLOW,"Come back later.");
return 1;
}
//LSPD Base
CreateObject(1411,1548.751,-1620.444,14.156,0.0,0.0,-90.000);
CreateObject(1411,1548.879,-1634.387,13.992,0.0,0.0,-90.000);
return 0;
}
Re: Moving gates problem 3 ! -
Last_Stand_Guardian - 06.04.2010
2. Maybe you've reloaded the filterscript a bit too often? xD
If you don't say that the objects should be destroyed OnFilterScriptExit, they won't :O
pawn Код:
OnFilterScriptExit
{
DestroyObject(lpgate);
return 1;
}
1. Where have you declared the rank system? (In the Gamemode right? xD)
Put the gate system into the gamemode, or try to use
^^
Re: Moving gates problem 3 ! -
Kirchhoff - 06.04.2010
I didnt understood nothing from what you've said !
Re: Moving gates problem 3 ! -
Last_Stand_Guardian - 06.04.2010
Ok Ok xD
Now I try to write better English ^^
_________________________________________________
For problem number 1:
Where do you have declared the rank system? (Gamemode?, Filterscript?)
Case: Gamemode:
2 options:
1. Put the gate commands + the object-create functions into the gamemode
2. Try to create a function in the gamemode and use CallRemoteFunction in the filterscript
_________________________________________________
For problem number 2:
Objects in filterscripts aren't deleted after unload or reload =D
But if you reload the filterscript, the same objects are created again xD
So you must destroy the objects after reload with:
pawn Код:
OnFilterScriptExit()
{
DestroyObject(lspgate);
return 1;
}
_________________________________________________
Better? xD
Re: Moving gates problem 3 ! -
Kirchhoff - 06.04.2010
Ok i try it now !
Re: Moving gates problem 3 ! -
Kirchhoff - 06.04.2010
But i want to destroy those 2 objects from the //lspd base not the lsp gate !!! // Done !
//EDIT : or could be a lot easier if you would me at problem 1 instead of rank 1 : TEAM_COP . So if you are not a cop you can't open the gates of lspd like the mesage : You are not in the cop team !
Re: Moving gates problem 3 ! -
Joe_ - 06.04.2010
No need to shout m8.
pawn Код:
public OnFilterScriptInit()
{
for(new o; o < 3; o++) // Loops around all objects, there is 3 objects, so we will loop 3 times.
{
DestoryObject(o);
}
return 1;
}
That will destory every object, including the gate.
2).
secondly, you will have to add a if statement (A check) for your command.
pawn Код:
if(varible >= number) // if the varible is more or equals the number
{
// do something, so in this case, put the MoveObject etc.
}
return 0; // If the varible is not more or does not equal the number, return 0 / False.
Here is a common example, this may not compile in your script!
pawn Код:
if(pdata[playerid][level] >= 1) // Playerid's level is more or equals 1.
{
// Open the gate
MoveObject(lpgate, 1548.571,-1634.002,14.058,3);
SendClientMessage(playerid, COLOR_YELLOW,"Welcome to LSPD!");
return 1;
}
return SendClientMessage(playerid, YOUR_DESIRED_COLOR, "Error: You are not high enough level."); // Returns a error message if you do not have a high enough level.
if(pdata[playerid][level] >=1) // Playerid's level is more of equals 1.
{
// Closes the gate
MoveObject(lpgate, 1548.571,-1627.423,14.058,3);
SendClientMessage(playerid, COLOR_YELLOW,"Come back later.");
return 1;
}
return SendClientMessage(playerid, YOUR_DESIRED_COLOR, "Error: You are not high enough level."); // Returns a error message if you do not have a high enough level.
Not tested, but should work.
Replace ' pdata[playerid][level] ' with the array that defines the level of the player.
Re: Moving gates problem 3 ! -
Kirchhoff - 06.04.2010
but i dont want the gate to be opened with the player level ! I want it to be opened with the rank of the player !
0 - normal rank
1 - cop rank
2 - army rank
3 - swat rank
So rank 1 !
Re: Moving gates problem 3 ! -
Joe_ - 06.04.2010
AS I SAID! NO NEED TO SHOUT!
Same thing dude, rank 1 = level 1 or something, you make the array however -YOU- Want it.
I could name it ' pdata[playerid][bigassholefaggot] ' if I wanted, and it could be admin level.
Re: Moving gates problem 3 ! -
Kirchhoff - 07.04.2010
Still not solved idk how to do it ! Bump , if someone can edit me the script i will be very gratefull !