Blinking Radar Player Icons
This is just a simple script but can be very useful for "highlighting" a player, for instance with a bounty of more than 500,000
Global Variables:
pawn Код:
new bool:blinking[MAX_PLAYERS][2];
In OnGameModeInit
pawn Код:
SetTimer("BlipControl",1000,true);
New Function:
pawn Код:
ToggleBlipBlinking(playerid,bool:toggle) blinking[playerid][0] = toggle;
The Timer function:
pawn Код:
public BlipControl(){
for(new i=0;i<MAX_PLAYERS;i++){
if(blinking[i][0] == true){
if(IsPlayerConnected(i)){
if(blinking[i][1] == true){
ToggleBlipVisibility(i,false);
blinking[i][1] = false;
}
else{
ToggleBlipVisibility(i,true);
blinking[i][1] = true;
}
}
else blinking[i][0] = false;
}
}
}
Thanks to Simon for his ToggleBlipVisibility function
Speedometer
I made this small speedometer example because people were always bugging me to release the source of one thats easy to put in a gamemode and thats free to use in any script so here it is:
Defines:
pawn Код:
#define MPS 0
#define KMPH 1
#define MPH 2
#define KNOTS 3
#define SPEED KMPH
Global Variable:
pawn Код:
new Float:ppos[MAX_PLAYERS][3];
In OnGameModeInit
pawn Код:
SetTimer("Speed",1000,true);
And the timer:
pawn Код:
public Speed(){
for(new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(i)){
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
new Float:dis = floatsqroot(floatpower(floatabs(floatsub(ppos[i][0],x)),2)+
floatpower(floatabs(ppos[i][1],y)),2)+floatpower(floatabs(floatsub(ppos[i][2],z)),2));
new tmpstr[256];
pawn Код:
#if SPEED == MPS
format(tmpstr,sizeof(tmpstr),"~n~~n~~n~~n~ %d~r~MPS",floatround(dis));
#endif
#if SPEED == KMPH
format(tmpstr,sizeof(tmpstr),"~n~~n~~n~~n~ %d ~r~KMPH",floatround(((dis/1000.0)*60.0)*60.0);
#endif
#if SPEED == MPH
format(tmpstr,sizeof(tmpstr),"~n~~n~~n~~n~ %d ~r~MPH",floatround(((dis/1000.0)*60.0)*60.0)*(5.0/8.0));
#endif
#if SPEED == KNOTS
format(tmpstr,sizeof(tmpstr),"~n~~n~~n~~n~ %d ~r~KNOTS",floatround((((dis/1000.0)*60.0)*60.0)/1.85));
#endif
if(IsPlayerInAnyVehicle(i)) GameTextForPlayer(i,tmpstr,2000,4);
ppos[i][0] = x;
ppos[i][1] = y;
ppos[i][2] = z;
}
}
}