guys really need help -
Joe Vagos - 31.07.2012
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 !
Re: guys really need help -
DeathOnaStick - 31.07.2012
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.
Re: guys really need help -
Universal - 31.07.2012
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)?
Re: guys really need help -
DeathOnaStick - 31.07.2012
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.
Re: guys really need help -
Joe Vagos - 31.07.2012
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
Re: guys really need help -
DeathOnaStick - 31.07.2012
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.
Re: guys really need help -
Joe Vagos - 31.07.2012
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
Re: guys really need help -
TaLhA XIV - 31.07.2012
PHP код:
public IsPlayerInArea()
{
}
Re: guys really need help -
XStormiest - 31.07.2012
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;
}
Re: guys really need help -
Joe Vagos - 31.07.2012
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