guys really need help
#1

hey, by accident i found a bank- time system that i need but i cant make it work as it gives me errors

here is the code

Код:
  timer1 = SetTimer("isPlayerInArea",100, 1);
  timer2 = SetTimer("BankTime", 999, 1);

public isPlayerInArea()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722))
		{
			SendClientMessage(i, 0xFFFF00AA, "( ! ) Welcome to Bank!");
			KillTimer(timer1);
			return 1;
		}
  }
  return 1;
}

public BankTime()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
	if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722))
		{
		new hours;
		new minutes;
		GetPlayerTime(i, hours, minutes);
  	if(hours == 6.00 && minutes == 0.00)
 		  {
			PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
			GivePlayerMoney(i, 7500);
			SendClientMessage(i, 0x12900BBF, "||| 6:00 | BANK TIME: |||");
			SendClientMessage(i, 0xFFFF00AA, "YOU RECEIVE +7.500 $");
			KillTimer(timer2);
			return 1;
			}
		}
  }
  return 1;
}
and here is the errors that it gives me srry iam new scripter

errors
C:\Users\Joe\Desktop\{}.pwn(3) : error 010: invalid function or declaration
C:\Users\Joe\Desktop\{}.pwn(6) : warning 235: public function lacks forward declaration (symbol "isPlayerInArea")
C:\Users\Joe\Desktop\{}.pwn(10) : error 017: undefined symbol "IsPlayerInArea"
C:\Users\Joe\Desktop\{}.pwn(13) : error 017: undefined symbol "timer1"
C:\Users\Joe\Desktop\{}.pwn(20) : warning 235: public function lacks forward declaration (symbol "BankTime")
C:\Users\Joe\Desktop\{}.pwn(24) : error 017: undefined symbol "IsPlayerInArea"
C:\Users\Joe\Desktop\{}.pwn(29) : warning 217: loose indentation
C:\Users\Joe\Desktop\{}.pwn(35) : error 017: undefined symbol "timer2"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.


i hope guys u could help me cause really i need helping !
Reply
#2

The first two lines that you've got have to be implemented into somewhere where code is executed, like OnFilterscriptInit/OnGamemodeInit (depends on script). Like that:

pawn Код:
new timer1,timer2;

public OnFilterscriptInit(){
     timer1 = SetTimer("isPlayerInArea",100, 1);
  timer2 = SetTimer("BankTime", 999, 1);
}
Then you need to forward isPlayerInArea and BankTime like this:

pawn Код:
forward isPlayerInArea();
public isPlayerInArea()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722))
        {
            SendClientMessage(i, 0xFFFF00AA, "( ! ) Welcome to Bank!");
            KillTimer(timer1);
            return 1;
        }
  }
  return 1;
}

forward BankTime();
public BankTime()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722))
        {
        new hours;
        new minutes;
        GetPlayerTime(i, hours, minutes);
    if(hours == 6.00 && minutes == 0.00)
          {
            PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
            GivePlayerMoney(i, 7500);
            SendClientMessage(i, 0x12900BBF, "||| 6:00 | BANK TIME: |||");
            SendClientMessage(i, 0xFFFF00AA, "YOU RECEIVE +7.500 $");
            KillTimer(timer2);
            return 1;
            }
        }
  }
  return 1;
}
This will probably fix everything.
Reply
#3

Do you understand, that KillTimer kills the timer, which means its not going to be used ever again, unless you call it again via SetTimer, which you call upon FilterscriptInit or restart the gamemode (filterscript in your case)?
Reply
#4

Quote:
Originally Posted by Universal
Посмотреть сообщение
Do you understand, that KillTimer kills the timer, which means its not going to be used ever again, unless you call it again via SetTimer, which you call upon FilterscriptInit or restart the gamemode (filterscript in your case)?
True!
Let's edit this a little bit...

pawn Код:
new timer1,timer2;

public OnFilterscriptInit(){
     timer1 = SetTimer("isPlayerInArea",100, 1);
  timer2 = SetTimer("BankTime", 999, 1);
}
Then you need to forward isPlayerInArea and BankTime like this:

pawn Код:
forward isPlayerInArea();
public isPlayerInArea()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722))
        {
            SendClientMessage(i, 0xFFFF00AA, "( ! ) Welcome to Bank!");
            return 1;
        }
  }
  return 1;
}

forward BankTime();
public BankTime()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerInArea(i, 1711.4371, 1731.7839, -1670.3661, -1643.2722))
        {
        new hours;
        new minutes;
        GetPlayerTime(i, hours, minutes);
    if(hours == 6.00 && minutes == 0.00)
          {
            PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
            GivePlayerMoney(i, 7500);
            SendClientMessage(i, 0x12900BBF, "||| 6:00 | BANK TIME: |||");
            SendClientMessage(i, 0xFFFF00AA, "YOU RECEIVE +7.500 $");
            return 1;
            }
        }
  }
  return 1;
}
Now the timers live forever, but that should be okay in this case.
Reply
#5

C:\Users\mohamed\Desktop\{}.pwn(40) : error 017: undefined symbol "IsPlayerInArea"
C:\Users\mohamed\Desktop\{}.pwn(53) : error 017: undefined symbol "IsPlayerInArea"

after i edit it it gives me these errors
Reply
#6

Quote:
Originally Posted by Joe Vagos
Посмотреть сообщение
C:\Users\mohamed\Desktop\{}.pwn(40) : error 017: undefined symbol "IsPlayerInArea"
C:\Users\mohamed\Desktop\{}.pwn(53) : error 017: undefined symbol "IsPlayerInArea"

after i edit it it gives me these errors
You need a function called IsPlayerInArea. You need some include for it, search for it on the forums.
Reply
#7

could u give it to me as a iam anew one and i will apperciate that

Код:
stock IsPlayerInArea(playerid,Float:max_x,Float:min_x,Float:max_y,Float:min_y){new Float:X; new Float:Y;new Float:Z;GetPlayerPos(playerid, X, Y, Z); // On rйcupйre la position du joueurif(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) { // Si le joueur est dans les cordonnйes а dйfinirreturn 1;}return 0;}
thats all i found btw
Reply
#8

PHP код:
public IsPlayerInArea()
{


Reply
#9

hmm

i think

pawn Код:
stock IsPlayerInArea(playerid,radius,x,y,z)
  {
             if(IsPlayerInRangeOfPoint(playerid,radius,x,y,z) )
            {
                   return 1;
            }
  }
or if in another format
pawn Код:
stock IsPlayerInArea(playerid,targetid)
{
        new Float:X,Float,Float:Z;
       GetPlayerPos(targetid,X,Y,Z)
       
       if(IsPlayerInRangeOfPoint(playerid,5.0,X,Y,Z)  )
      {
              return 1;
      }
  return 1;
}
Reply
#10

C:\Users\mohamed\Desktop\{}.pwn(39) : error 017: undefined symbol "radius"
C:\Users\Joe\Desktop\{}.pwn(43) : warning 209: function "IsPlayerInArea" should return a value
C:\Users\Joe\Desktop\{}.pwn(37) : warning 203: symbol is never used: "targetid"
C:\Users\Joe\Desktop\{}.pwn(50) : warning 213: tag mismatch
C:\Users\Joe\Desktop\{}.pwn(50) : warning 202: number of arguments does not match definition
C:\Users\Joe\Desktop\{}.pwn(50) : warning 202: number of arguments does not match definition
C:\Users\Joe\Desktop\{}.pwn(50) : warning 202: number of arguments does not match definition
C:\Users\Joe\Desktop\{}.pwn(64) : warning 213: tag mismatch
C:\Users\Joe\Desktop\{}.pwn(64) : warning 202: number of arguments does not match definition
C:\Users\Joe\Desktop\{}.pwn(64) : warning 202: number of arguments does not match definition
C:\Users\Joe\Desktop\{}.pwn(64) : warning 202: number of arguments does not match definition
C:\Users\Joe\Desktop\{}.pwn(69) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error

that when i use the 1st format
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)