SA-MP Forums Archive
Pay at gates - 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: Pay at gates (/showthread.php?tid=321297)



Pay at gates - livests - 26.02.2012

hy how make in this script with pay function at gates?

Quote:

forward Gates1Check();
public Gates1Check()
{
new gates1_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, 1780.80004883, 701.40002441, 15.80000019))gates1_status=1;
}
if(gates1_status)MoveObject(gates1, 1780.69995117, 701.40002441, 12.80000019, 0.5);
else MoveObject(gates1, 1780.80004883, 701.40002441, 15.80000019, 6.5);
return;
}




Re: Pay at gates - niels44 - 26.02.2012

when the gates open use:
pawn Код:
GivePlayerMoney(playerid, -50);
now the money of the player will get reduced with $50 so he pays $50 for the gates.

place it at the place in your code where you want it


Re: Pay at gates - Shabi RoxX - 26.02.2012

pawn Код:
forward Gates1Check();
public Gates1Check()
{
new gates1_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, 1780.80004883, 701.40002441, 15.80000019))gates1_status=1;
}
if(gates1_status)
MoveObject(gates1, 1780.69995117, 701.40002441, 12.80000019, 0.5);
GivePlayerMoney(playerid,-1000);// 1000 Money on gate opening.....
else MoveObject(gates1, 1780.80004883, 701.40002441, 15.80000019, 6.5);
return;
}



Re: Pay at gates - livests - 26.02.2012

shows undifined simbol "playerid"

Quote:
Originally Posted by niels44
Посмотреть сообщение
when the gates open use:
pawn Код:
GivePlayerMoney(playerid, -50);
now the money of the player will get reduced with $50 so he pays $50 for the gates.

place it at the place in your code where you want it
and second tipe show

D:\trucking\filterscripts\toll1.pwn(40) : error 017: undefined symbol "playerid"
D:\trucking\filterscripts\toll1.pwn(41) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Re: Pay at gates - Shabi RoxX - 26.02.2012

Quote:
Originally Posted by livests
Посмотреть сообщение
shows undifined simbol "playerid"



and second tipe show

D:\trucking\filterscripts\toll1.pwn(40) : error 017: undefined symbol "playerid"
D:\trucking\filterscripts\toll1.pwn(41) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
You Have to Change You Funtion to Player Function... Like...

pawn Код:
forward Gates1Check(playerid);
public Gates1Check(playerid)
{
new gates1_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, 1780.80004883, 701.40002441, 15.80000019))gates1_status=1;
}
if(gates1_status)
MoveObject(gates1, 1780.69995117, 701.40002441, 12.80000019, 0.5);
GivePlayerMoney(playerid,-1000);// 1000 Money on gate opening.....
else MoveObject(gates1, 1780.80004883, 701.40002441, 15.80000019, 6.5);
return;
}
Now Use:
pawn Код:
Gates1Check(playerid);
In place of "Gates1Check();" in your command.


Re: Pay at gates - livests - 26.02.2012

ok it will show like this i guess
and need anounce tekst u pay toll how to get it?
Quote:

forward Gates1Check(playerid);
public Gates1Check(playerid)
{
new gates1_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, 1780.80004883, 701.40002441, 15.80000019))gates1_status=1;
GivePlayerMoney(playerid,-20);
}
if(gates1_status)MoveObject(gates1, 1780.69995117, 701.40002441, 12.80000019, 0.5);
else MoveObject(gates1, 1780.80004883, 701.40002441, 15.80000019, 6.5);
return;
}




Re: Pay at gates - Shabi RoxX - 26.02.2012

Quote:
Originally Posted by livests
Посмотреть сообщение
still shows D:\trucking\filterscripts\toll1.pwn(41) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
and how to get show like anounce u pay toll **$
Please Post Command in Which you are using this Function...


pawn Код:
SendClientMessage(playerid,0xFFFAAA,"You Have paid for toll.");
Use this for sending message to playerid.


Re: Pay at gates - livests - 26.02.2012

i to like u say but then im near gates they open and dont need to pay and if i put ther u say then show invalid expresion assumed zero

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
You Have to Change You Funtion to Player Function... Like...

pawn Код:
forward Gates1Check(playerid);
public Gates1Check(playerid)
{
new gates1_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, 1780.80004883, 701.40002441, 15.80000019))gates1_status=1;
}
if(gates1_status)
MoveObject(gates1, 1780.69995117, 701.40002441, 12.80000019, 0.5);
GivePlayerMoney(playerid,-1000);// 1000 Money on gate opening.....
else MoveObject(gates1, 1780.80004883, 701.40002441, 15.80000019, 6.5);
return;
}
Now Use:
pawn Код:
Gates1Check(playerid);
In place of "Gates1Check();" in your command.



Re: Pay at gates - Shabi RoxX - 26.02.2012

Post cOMMAND cODES


Re: Pay at gates - livests - 26.02.2012

#include <a_samp>
//#if defined FILTERSCRIPT
new gates1;
new gates2;
new gates3;
new gates4;
new gates5;
new gates6;

public OnFilterScriptInit()
{
SetTimer("Gates1Check", 500, true);
SetTimer("Gates2Check", 500, true);
SetTimer("Gates3Check", 500, true);
SetTimer("Gates4Check", 500, true);
SetTimer("Gates5Check", 500, true);
SetTimer("Gates6Check", 500, true);

gates1 = CreateObject(8674, 1780.80004883, 701.40002441, 15.80000019, 0.00000000, 0.00000000, 352.00000000);
gates2 = CreateObject(8674, 1795.40002441, 713.09997559, 14.89999962, 0.00000000, 0.00000000, 354.00000000);
gates3 = CreateObject(971, -2667.80004883, 1277.90002441, 56.29999924, 0.00000000, 0.00000000, 0.00000000);
gates4 = CreateObject(971, -2677.30004883, 1277.59997559, 56.29999924, 0.00000000, 0.00000000, 0.00000000);
gates5 = CreateObject(971, -2686.19995117, 1271.50000000, 56.29999924, 0.00000000, 0.00000000, 178.00000000);
gates6 = CreateObject(971, -2695.39990234, 1270.59997559, 56.20000076, 0.00000000, 0.00000000, 178.00000000);

//gate = CreateObject(Model id, x, y, z, rx, ry, rz); = How to set up the gate. Use the closed position
return 1;
}

forward Gates1Check(playerid);
public Gates1Check(playerid)
{
new gates1_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, 1780.80004883, 701.40002441, 15.80000019))gates1_status=1;
}
if(gates1_status)MoveObject(gates1, 1780.69995117, 701.40002441, 12.80000019, 0.5);
GivePlayerMoney(playerid,-20);
SendClientMessage(playerid,0xFFFAAA,"You Have paid for toll.");
else MoveObject(gates1, 1780.80004883, 701.40002441, 15.80000019, 6.5);
return;
}


D:\trucking\filterscripts\toll1.pwn(42) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.