Moving gate...
#1

Hello i want to make moving gate for my base here is the cordinates

Closed gate
CreateObject(985,1545.1000000,-1627.6000000,14.1000000,0.0000000,0.0000000,90.000 0000);

Open gate
CreateObject(985,1545.1000000,-1620.1000000,14.1000000,0.0000000,0.0000000,90.000 0000);


i try myself but i got so many errors... but i want this gate open automatically only for this ped's
lapd1, sfpd1, lvpd1, lapdm1, csher, dsher, swat, army and FBI. Only this peds open automatically gate.. thx in advance
Reply
#2

try this, remove the previous CreateObject code and try this.
pawn Код:
new object = CreateObject(985,1545.1000000,-1627.6000000,14.1000000,0.0000000,0.0000000,90.000 0000);

CMD:movegate(playerid, params[])
{
//MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed);
MoveObject(object, 1545.1000000, -1620.1000000, 14.1000000, 1.0);
return 1;
}
Read about MoveObject, here: https://sampwiki.blast.hk/wiki/MoveObject
Reply
#3

And to open it automatically, just check whether the player is a law member, if they are, open the gate.
Reply
#4

where to add this?
Reply
#5

Hi!

I hope this is that what you want.
PHP код:
//global:
new object,bool:gateOpen;
//OnGameModeInit:
object CreateObject(985,1545.1000000,-1627.6000000,14.1000000,0.0000000,0.0000000,90.000 0000);
//OnGameModeInit:
SetTimer("OpenGateAuto",1000,1);
//callback #1:
forward OpenGateAuto();
public 
OpenGateAuto()
{
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i))continue;
        if(
SpielerInfo[i][Fraction] != || SpielerInfo[i][Fraction] != 2)continue;//fraction query; you can optimized this
        
if(gateOpen == true)break;
        
MoveObject(object1545.1000000, -1620.100000014.10000001.0);
        
gateOpen true;
        
SetTimer("CloseGateAuto",1000,1);
    }
    return 
1;
}
//callback #2:
forward CloseGateAuto();
public 
CloseGateAuto()
{
    
MoveObject(object1545.1000000,-1627.6000000,14.10000001.0);
    
gateOpen false;
    return 
1;

Reply
#6

Quote:

C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(42) : error 001: expected token: ",", but found "-integer value-"
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(42) : warning 215: expression has no effect
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(42) : error 001: expected token: ";", but found ")"
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(42) : error 029: invalid expression, assumed zero
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(42) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

And that is how i addd where i wrong?

Quote:

new object,bool:gateOpen;

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif


public OnGameModeInit()
{
//Text
SetGameModeText("TWD1.0");
//Running Style
UsePlayerPedAnims();
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
//Бази
//Army Base
object = CreateObject(985,1545.1000000,-1627.6000000,14.1000000,0.0000000,0.0000000,90.000 0000);
SetTimer("OpenGateAuto",1000,1);
return 1;
}

forward OpenGateAuto();
public OpenGateAuto()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i))continue;
if(SpielerInfo[i][Fraction] != 1 || SpielerInfo[i][Fraction] != 2)continue;//fraction query; you can optimized this
if(gateOpen == true)break;
MoveObject(object, 1545.1000000, -1620.1000000, 14.1000000, 1.0);
gateOpen = true;
SetTimer("CloseGateAuto",1000,1);
}
return 1;
}

//callback #2:
forward CloseGateAuto();
public CloseGateAuto()
{
MoveObject(object, 1545.1000000,-1627.6000000,14.1000000, 1.0);
gateOpen = false;
return 1;
}

Reply
#7

PHP код:
public OnGameModeInit()
{
    
//Text
    
SetGameModeText("TWD1.0");
    
//Running Style
    
UsePlayerPedAnims();
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    
//????
    //Army Base
    
object CreateObject(985,1545.1000000,-1627.6000000,14.1000000,0.0000000,0.0000000,90.0000000);
    
SetTimer("OpenGateAuto",1000,1);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)