SA-MP Forums Archive
gate moving problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: gate moving problem (/showthread.php?tid=185454)



gate moving problem - Tom1412 - 24.10.2010

iv added a close command bit but im getting errors

errors
PHP код:
C:\Users\tom\Desktop\MOB Real Server\filterscripts\pay.pwn(7) : error 017undefined symbol "playerid"
C:\Users\tom\Desktop\MOB Real Server\filterscripts\pay.pwn(10) : error 010invalid function or declaration
C
:\Users\tom\Desktop\MOB Real Server\filterscripts\pay.pwn(11) : error 010invalid function or declaration
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
3 Errors

PHP код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
new gateobject;
public 
OnFilterScriptInit()
{
      
MoveObject(gateobject,1101.7249755859, -1741.276733398415.2739582061770.97);
      
PlayerPlaySound(playerid,1101.7249755859, -1741.276733398415.273958206177);
      return 
1;
}
    
gateobject CreateObject(980,1101.7249755859, -1741.276733398415.2739582061770090);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/buyticket"cmdtexttrue10) == 0)
    {
    if(
GetPlayerMoney(playerid) <= 50) return SendClientMessage(playerid0xFFFFFF"You are to far to pay.");
    
GivePlayerMoney(playerid, -25);    MoveObject(gateobject,1101.7249755859, -1752.276733398415.2739582061770.97);
    
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open");
    return 
1;
    }
    return 
0;




Re: gate moving problem - Grim_ - 24.10.2010

OnFilterScriptInit is called once the script is started. You need to move those functions into another callback, like OnPlayerCommandText after the player types a command.


Re: gate moving problem - Bogdanovic - 24.10.2010

Try whit this...

#include <a_samp>
#define COLOR_RED 0xAA3333AA

new gateobject;

public OnFilterScriptInit()
{
gateobject = CreateObject(980,1101.7249755859, -1741.2767333984, 15.273958206177, 0, 0, 90);
MoveObject(gateobject,1101.7249755859, -1741.2767333984, 15.273958206177, 0.97);
FucnSound();
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buyticket", cmdtext, true, 10) == 0)
{
if (GetPlayerMoney(playerid) <= 50) return SendClientMessage(playerid, 0xFFFFFF, "You are to far to pay. ");
GivePlayerMoney(playerid, -25); MoveObject(gateobject,1101.7249755859, -1752.2767333984, 15.273958206177, 0.97);
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open ");
return 1;
}
return 0;
}

forward FuncSound();
public FuncSound()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i ,1101.7249755859, -1741.2767333984, 15.273958206177);
}
}



Re: gate moving problem - Tom1412 - 24.10.2010

nope still got some errors and warning


Re: gate moving problem - Bogdanovic - 24.10.2010

Oh yes, try this...

#include <a_samp>
#define COLOR_RED 0xAA3333AA

new gateobject;

public OnFilterScriptInit()
{
gateobject = CreateObject(980,1101.7249755859, -1741.2767333984, 15.273958206177, 0, 0, 90);
MoveObject(gateobject,1101.7249755859, -1741.2767333984, 15.273958206177, 0.97);
FuncSound();
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buyticket", cmdtext, true, 10) == 0)
{
if (GetPlayerMoney(playerid) <= 50) return SendClientMessage(playerid, 0xFFFFFF, "You are to far to pay. ");
GivePlayerMoney(playerid, -25); MoveObject(gateobject,1101.7249755859, -1752.2767333984, 15.273958206177, 0.97);
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open ");
return 1;
}
return 0;
}

forward FuncSound();
public FuncSound()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
// Your Function Sound
}
}


I have Compiled without Error.


Re: gate moving problem - Tom1412 - 24.10.2010

thanx it opens but can u help me set it so it closes


Re: gate moving problem - Bogdanovic - 24.10.2010

Ok, try this...

#include <a_samp>
#define TIMER 5000 //Insert You Timer for Close the Gate :]
#define COLOR_RED 0xAA3333AA

new gateobject;

public OnFilterScriptInit()
{
gateobject = CreateObject(980,1101.7249755859, -1741.2767333984, 15.273958206177, 0, 0, 90);
MoveObject(gateobject,1101.7249755859, -1741.2767333984, 15.273958206177, 0.97);
FuncSound();
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buyticket", cmdtext, true, 10) == 0)
{
if (GetPlayerMoney(playerid) <= 50) return SendClientMessage(playerid, 0xFFFFFF, "You are to far to pay. ");
GivePlayerMoney(playerid, -25); MoveObject(gateobject, 1101.7249755859, -1752.2767333984, 15.273958206177, 0.97);
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open ");
SetTimer("FuncCL", TIMER, 0);
return 1;
}
return 0;
}

forward FuncSound();
public FuncSound()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
// Your Function Sound
}
}

forward FuncCL();
public FuncCL()
{
MoveObject(gateobject,1101.7249755859, -1752.2767333984, 15.273958206177, 0.97); //Insert You Float For Close The Gate
}



Re: gate moving problem - Scripter123 - 24.10.2010

So you wanna automatic gat with automatic close huh?


Re: gate moving problem - Tom1412 - 24.10.2010

it opens half way then closes