new bool:PedagioPago[MAX_PLAYERS];
public IsPlayerAtToll()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerInRangeOfPoint(playerid,10.0,828.90002441406,-2046.8409423828,12.89999961853))
{
SetObjectRot(Gate1,0,0,0);
SendClientMessage(playerid, COR_ROXO, "Vocк Pagou o Pedagio e a Cancela se Abriu.");
SendClientMessage(playerid, COLOR_RED, "-$500");
GivePlayerMoney(playerid, -500);
SetTimerEx("CloseGate", 5000, false, "i", Gate1);
}
}
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerInRangeOfPoint(playerid,10.0,843.3994140625,-2060.498046875,12.89999961853))
{
SetObjectRot(Gate2,0,0,0);
SendClientMessage(playerid, COR_ROXO, "Vocк Pagou o Pedagio e a Cancela se Abriu.");
SendClientMessage(playerid, COLOR_RED, "-$500");
GivePlayerMoney(playerid, -500);
SetTimerEx("CloseGate2", 5000, false, "i", Gate2);
}
}
return 1;
}
public IsPlayerAtToll()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerInRangeOfPoint(playerid,10.0,828.90002441406,-2046.8409423828,12.89999961853))
{
SetObjectRot(Gate1,0,0,0);
SendClientMessage(playerid, COR_ROXO, "Vocк Pagou o Pedagio e a Cancela se Abriu.");
SendClientMessage(playerid, COLOR_RED, "-$500");
GivePlayerMoney(playerid, -500);
SetTimerEx("CloseGate", 5000, false, "i", Gate1);
}
if(IsPlayerInRangeOfPoint(playerid,10.0,843.3994140625,-2060.498046875,12.89999961853))
{
SetObjectRot(Gate2,0,0,0);
SendClientMessage(playerid, COR_ROXO, "Vocк Pagou o Pedagio e a Cancela se Abriu.");
SendClientMessage(playerid, COLOR_RED, "-$500");
GivePlayerMoney(playerid, -500);
SetTimerEx("CloseGate2", 5000, false, "i", Gate2);
}
}
return 1;
}
if(IsPlayerInRangeOfPoint(playerid,10.0,828.90002441406,-2046.8409423828,12.89999961853) && PedagioPago[playerid] == false)
if(IsPlayerInRangeOfPoint(playerid,10.0,843.3994140625,-2060.498046875,12.89999961853) && PedagioPago[playerid] == false)
Antes de mais nada.
Й desnecessбrio usar dois loops : ) pawn Код:
|
Editei o post e coloquei dois " if "
Substitui os outros pelos novos. E usa a funзгo CloseGate2 pra tornar PedagioPago[playerid] falso novamente, evitando que o jogador pague apenas um pedбgio por vez cada vez que logar. |
Posta CloseGate, que eu te mostro como ficaria.
Daн vocк faz o outro depois. |
public CloseGate2(gateid)
{
if(gateid == Gate2)
{
SetObjectRot(Gate2,0,90,0);
}
return 1;
}
//-----------------------------------------
public CloseGate(gateid)
{
if(gateid == Gate1)
{
SetObjectRot(Gate1,0,270,0);
}
return 1;
}
public IsPlayerAtToll()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerInRangeOfPoint(playerid,10.0,828.90002441406,-2046.8409423828,12.89999961853) && PedagioPago[playerid] == false)
{
SetObjectRot(Gate1,0,0,0);
SendClientMessage(playerid, COR_ROXO, "Vocк Pagou o Pedagio e a Cancela se Abriu.");
SendClientMessage(playerid, COLOR_RED, "-$500");
GivePlayerMoney(playerid, -500);
PedagioPago[playerid] = true;
SetTimerEx("CloseGate", 5000, false, "ii", Gate1,playerid);
}
else if(IsPlayerInRangeOfPoint(playerid,10.0,843.3994140625,-2060.498046875,12.89999961853) && PedagioPago[playerid] == false)
{
SetObjectRot(Gate2,0,0,0);
SendClientMessage(playerid, COR_ROXO, "Vocк Pagou o Pedagio e a Cancela se Abriu.");
SendClientMessage(playerid, COLOR_RED, "-$500");
GivePlayerMoney(playerid, -500);
PedagioPago[playerid] = true;
SetTimerEx("CloseGate2", 5000, false, "ii", Gate2,playerid);
}
}
return 1;
}
public CloseGate(gateid,playerid)
{
if(gateid == Gate1)
SetObjectRot(Gate1,0,270,0);
if(gateid == Gate2)
SetObjectRot(Gate2,0,90,0);
PedagioPago[playerid] = false;
return 1;
}
No SetTimer que vocк chama a funзгo do IsPlayerAtToll, coloque um if acima.
Exemplo: pawn Код:
|
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(946) : error 017: undefined symbol "playerid"
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(947) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerInAnyVehicle(playerid)) return SetTimer("IsPlayerAtToll", 200, true);
else SendClientMessage(playerid, -1, "Vocк deve estar em algum carro para abrir a cancela.");
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(159) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(205) : error 017: undefined symbol "strtok"
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(205) : error 033: array must be indexed (variable "cmd")
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(208) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(209) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(210) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(211) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(216) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(217) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(218) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(219) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(220) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(221) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(222) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(223) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(224) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(225) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(229) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(230) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(231) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(232) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(233) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(234) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(235) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(236) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\Cliente\Desktop\Games\Server\gamemodes\lvdm.pwn(240) : error 004: function "SendPlayerFormattedText" is not implemented
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
26 Errors.
new playerid;
if(IsPlayerInAnyVehicle(playerid)) SetTimer("IsPlayerAtToll", 200, true);
else SendClientMessage(playerid, -1, "[INFO]Vocк deve estar dentro de um Veнculo para abrir a cancela, se as Entradas de Pedestres.");