28.01.2012, 21:29
O radar nгo funciona D:
e tem 3 warn , eu fiz de acordo com uma FS que coloquei a pastebin no final ,
Se acharem algum erro por favor me diga eu ja tentei de tudo .-.
Obrigado desde jб .
Isto tudo estб no topo ~ (o cуdigo acima)
WARNINGS
Fiz esse sistema de acordo com essa FS
http://pastebin.com/vsVn6C2V
![Smiley](images/smilies/smile.png)
PS : Os radares nгo funcionam D;
e tem 3 warn , eu fiz de acordo com uma FS que coloquei a pastebin no final ,
Se acharem algum erro por favor me diga eu ja tentei de tudo .-.
Obrigado desde jб .
pawn Код:
//------------Radar--------------
new UpdateSeconds = 2; // Nгo Mecher
new maxobject = 4;
//----------------------------------------
public OnFilterScriptInit() {
print("\n----------------------------------");
print("[FS] Radar Automatico Carregado");
print("----------------------------------\n");
SetTimer("UpdateSpeed", UpdateSeconds*1000, 1);
}
public OnFilterScriptExit() {
print("\n----------------------------------");
print("[FS] Radar Automatico Desativado");
print("----------------------------------\n");
}
forward UpdateSpeed(playerid);
enum SavePlayerPosEnum {
Float:LastX,
Float:LastY,
Float:LastZ
}
#define COLOR_YELLOW 0xFFFF00AA
#define VERDEFRACO 0x80cf80AA
#define SLOTS 500
new objectcreated;
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
new distance1[MAX_PLAYERS];
// RADAR FIM
// Radar
public UpdateSpeed(playerid)
{
new Float:x,Float:y,Float:z;
new Float:distance,value;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
value = floatround(distance * 3600);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
distance1[i] = floatround(value/1600);
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
/* Para colocar Coordenada no lugar que voce quer , basta colocar a Coordenada X,Y,Z no lugar dos 00000 ,
o 40 й o radio , que o radar pega, e o 50 , й a velocidade maxima*/
AddFlitsPaal(i, 1278, 1476.2402,-1726.3396,13.5469, 40, 50); // Radar da DP PM
AddFlitsPaal(i, 1278, 1524.1256,-1679.0756,13.5469, 40, 50); // Prefeitura
AddFlitsPaal(i, 1278, 2048.7131,1353.5975,10.6719, 40, 50); // BANCO
AddFlitsPaal(i, 1278, 1200.9847,-1337.9875,13.3984, 40, 45); // HOSPITAL
AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 50, 70); // VAGO
AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
AddFlitsPaal(i, 1278, 0000.0000,0000.0000,0000.0000, 20, 50); // VAGO
}
}
}
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{ // Nгo й do radar
if (GetPlayerState(playerid) == 1)
{
return 1;
}
if(Sequestrado[playerid] == 1)
{
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), GetPlayerVehicleSeat(playerid));
}
if (gPlayerTerminal[playerid] != 0)
{
BusrouteEnd(playerid);
}
TogglePlayerControllable(playerid, 1);
return 1;
} // Nгo й do radar
// Agora sim й o radar ._.
IsPlayerInCircle(playerid,Float:x,Float:y,radius)
{
if(GetPlayerDistanceToPoint(playerid,Float:x,Float:y) < radius)
{
return 1;
}
return 0;
}
GetPlayerDistanceToPoint(playerid,Float:x,Float:y)
{
new Float:x1,Float:y1,Float:z1; GetPlayerPos(playerid,x1,y1,z1);
new Float:tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+
floatpower(floatabs(floatsub(y,y1)),2));
return floatround(tmpdis);
}
stock AddFlitsPaal(playerid, modelid, Float:xx, Float:yy, Float:zz, radius, speed) // Linha do warn :3
{
new fine[MAX_PLAYERS];
new str[256];
if(objectcreated!=maxobject)
{
CreateObject(modelid, xx, yy, zz, 0.0, 0.0, 10);
objectcreated++;
}
if((distance1[playerid])>speed)
{
if(IsPlayerInCircle(playerid, xx, yy, radius) && GetPlayerState(playerid)== PLAYER_STATE_DRIVER)
{
fine[playerid]=((distance1[playerid]*17/10)-speed);
GivePlayerMoney(playerid, -2000);
format(str,sizeof(str), "[RADAR xXX ] O Limite de velocidade й %d KM/H Voce Passou a %d KM/H e foi multado!",speed, distance1[playerid] ,fine[playerid]);
SendClientMessage(playerid, VERDEFRACO, str);
PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
}
}
}
pawn Код:
C:\Documents and Settings\Felipe\Desktop\Brasil Project Life v1.0\gamemodes\BIW.pwn(10054) : warning 219: local variable "xx" shadows a variable at a preceding level
C:\Documents and Settings\Felipe\Desktop\Brasil Project Life v1.0\gamemodes\BIW.pwn(10054) : warning 219: local variable "yy" shadows a variable at a preceding level
C:\Documents and Settings\Felipe\Desktop\Brasil Project Life v1.0\gamemodes\BIW.pwn(10054) : warning 219: local variable "zz" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Header size: 10984 bytes
Code size: 2107516 bytes
Data size: 2060428 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4608 cells (18432 bytes)
Total requirements: 4195312 bytes
3 Warnings.
http://pastebin.com/vsVn6C2V
![Smiley](images/smilies/smile.png)
PS : Os radares nгo funcionam D;