if(strcmp(cmd, "/radar", true) ==0 )
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /radar [id]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 200)
{
radarspeed(giveplayerid,playerid)
}
}
return 1;
}
public radarspeed(giveplayerid, playerid)
{
if(IsPlayerConnected(giveplayerid) && IsPlayerInAnyVehicle(giveplayerid))
{
if(gSpeedo[playerid] == 2)
{
new HGG[256];
GetPlayerPos(giveplayerid,Xa,Ya,Za);
KMH = floatsqroot(floatpower(floatabs(floatsub(Xa,Xb[giveplayerid])),2)+floatpower(floatabs(floatsub(Ya,Yb[giveplayerid])),2)+floatpower(floatabs(floatsub(Za,Zb[giveplayerid])),2));
KMH *= 6.2;
//Yukseklik = Za;
//format(HGG, sizeof(HGG), "~b~~h~~h~Name: ~w~%s~n~~g~~h~Speed: ~w~%0.0f km/h~n~~n~~y~~h~Fuel: ~w~%d ~n~~r~~h~Health: ~w~%.2f", ArIsim[GetVehicleModel(GetPlayerVehicleID(i))-400], KMH, Gas[vehicle], Can);
format(HGG,sizeof(HGG),"~n~~n~~n~~n~~n~~n~~n~~g~Vehicle: ~w~%s - ~g~Speed: ~w~%0.0f km/h", ArIsim[GetVehicleModel(GetPlayerVehicleID(giveplayerid))-400], KMH);
GameTextForPlayer(playerid, HGG, 2000, 5);
}
}
}
SetTimerEx("radarspeed",500,1,"ii",giveplayerid,playerid);
if(strcmp(cmd, "/radar", true) ==0 )
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /radar [id]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 200)
{
SetTimerEx("radarspeed",500,1,"ii",giveplayerid,playerid);
}
}
return 1;
}
|
Originally Posted by GTAguillaume
You need a timer. :P
|
|
Originally Posted by GTAguillaume
You need a timer. :P
Код:
SetTimerEx("radarspeed",500,1,"ii",giveplayerid,playerid);
|
|
Originally Posted by GTAguillaume
You need a timer. :P
Код:
SetTimerEx("radarspeed",500,1,"ii",giveplayerid,playerid);
EDIT2: what do you mean? The timer? |
|
Originally Posted by Everest Community
...gspeedo... if i then do /radar [ID] the othere players speed come up but only for a litte lite 3 seconds...
|
|
Originally Posted by Everest Community
Quote:
|
|
Originally Posted by ♣ Joker ♠
Lets start again
Quote:
yes it shows for exactly 2 seconds because of GameTextForPlayer(playerid, HGG, 2000, 5); Just say what the command should do, so we know what work is needed |
|
Originally Posted by Everest Community
Well the command is for police vehicles, When you are in a police vehicle like in real life you can see how fast other people is driving and i have create that now and it works perfect just taht i does only see the message for 2 seconds as you said, but i want the message to repeat until i want to turn it off by typing /turnoffradar and thats when the gspeedo comes.
|
|
Originally Posted by ♣ Joker ♠
Quote:
just use the code guillaume posted if you want to stop the timer you need to kill it (KillTimer) (for that you need to save the timerid) |