hi, I need some help making a little script...
Ok so i am making something that team bandits get information about a random driver, but I do not know how to do this... the only thing I know is that i will need a loop...
also I need it that there will be a new player in the textdrawstring every 10 seconds...
So final result should be: A bandit will always see info (I make this info myself) about a random player who is in gTeam[playerid] == TEAM_DRIVERS
Same problem...
pawn Код:
public OnPlayerUpdate(playerid)
{
if(gTeam[playerid] == TEAM_BANDIT)
{
new name[MAX_PLAYER_NAME], string[44];
new a;
for(new z,z<MAX_PLAYERS;z++)
{
a = Iter_Random(Player);
if(a != TEAM_DRIVERS)
{
z--;
continue;
}
GetPlayerName(a, name, sizeof(name));
format(string, sizeof(string), "%s",name);
TextDrawSetString(Opdracht, string);
break;
}
}
if(gTeam[playerid] == TEAM_UNSPAWNED)
{
new score2;
score2 = GetPlayerScore(playerid);
new string[128];
format(string,sizeof(string),"~w~Team Unspawned. ~y~Jump in the hole to choose your Class. ~w~ Your Score: ~r~%i",score2);
TextDrawSetString(Opdracht, string);
TextDrawShowForPlayer(playerid,Opdracht);
}
//==============================================================================
//90 Speedcams
//==============================================================================
for(new i; i != sizeof gObjects90; ++i) {
if(IsPlayerInRangeOfPoint(playerid, 25.0, gObjects90[i][0], gObjects90[i][1], gObjects90[i][2]) && IsPlayerInAnyVehicle(playerid)) {
if(IsFlashed[playerid] == 0)
{
if(gTeam[playerid] == TEAM_COPS)
{
SendClientMessage(playerid,COLOR_LIGHTBLUE, "* Since you are a cop, you cannot be caught by speedtraps.");
IsFlashed[playerid] = 1;
return 1;
}
else
{
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[300],/*final_speed_int,*/speed_string2[300];
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
final_speed_int[playerid] = floatround(final_speed,floatround_round);
if(final_speed_int[playerid] > 90)
{
SendClientMessage(playerid,COLOR_RED, " ");
format(speed_string,300,"* U were driving {FF6347}%i{FF0000}, while U were only allowed to drive {FF6347}90{FF0000}KPH, For that U must pay: ${FF6347}%i{FF0000}",final_speed_int[playerid], final_speed_int[playerid]*2);
//format(string,sizeof(string),"U were driving %i, while U were only allowed to drive 90KPH, For that U lost: %i bucks",vehspeed,vehspeed*2);
SendClientMessage(playerid,COLOR_RED, speed_string);
GameTextForPlayer(playerid,"~r~B~y~U~b~S~g~T~w~E~p~D",5000,3);
//Dialog om te betalen
format(speed_string2,300,"{FFFFFF}U must pay: ${FF6347}%i{FFFFFF}\nBecause You were Driving {FF6347}%i KPH{FFFFFF} Faster than allowed!\n\nIf you don't pay, U will becoma a suspect!",final_speed_int[playerid]*2,final_speed_int[playerid]-90);
ShowPlayerDialog(playerid,DIALOG_PAYME,DIALOG_STYLE_MSGBOX,"Speed Cam",speed_string2,"Pay","Fuck off!");
camflash(playerid);
SetTimerEx("resflashed",3000,false,"i",playerid);
IsFlashed[playerid] = 1;
ticket = final_speed_int[playerid]*2;
}
}
}
}
}
//==============================================================================
//120 Speedcams
//==============================================================================
for(new i; i != sizeof gObjects120; ++i) {
if(IsPlayerInRangeOfPoint(playerid, 25.0, gObjects120[i][0], gObjects120[i][1], gObjects120[i][2]) && IsPlayerInAnyVehicle(playerid)) {
if(IsFlashed[playerid] == 0)
{
if(gTeam[playerid] == TEAM_COPS)
{
SendClientMessage(playerid,COLOR_LIGHTBLUE, "* Since you are a cop, you cannot be caught by speedtraps.");
IsFlashed[playerid] = 1;
return 1;
}
else
{
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[300],/*final_speed_int,*/speed_string2[300];
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
final_speed_int[playerid] = floatround(final_speed,floatround_round);
if(final_speed_int[playerid] > 120)
{
SendClientMessage(playerid,COLOR_RED, " ");
format(speed_string,300,"* U were driving {FF6347}%i{FF0000}, while U were only allowed to drive {FF6347}120{FF0000}KPH, For that U must pay: ${FF6347}%i{FF0000}",final_speed_int[playerid], final_speed_int[playerid]*2);
//format(string,sizeof(string),"U were driving %i, while U were only allowed to drive 90KPH, For that U lost: %i bucks",vehspeed,vehspeed*2);
SendClientMessage(playerid,COLOR_RED, speed_string);
GameTextForPlayer(playerid,"~r~B~y~U~b~S~g~T~w~E~p~D",5000,3);
//Dialog om te betalen
format(speed_string2,300,"{FFFFFF}U must pay: ${FF6347}%i{FFFFFF}\nBecause You were Driving {FF6347}%i KPH{FFFFFF} Faster than allowed!\n\nIf you don't pay, U will becoma a suspect!",final_speed_int[playerid]*2,final_speed_int[playerid]-120);
ShowPlayerDialog(playerid,DIALOG_PAYME+2,DIALOG_STYLE_MSGBOX,"Speed Cam",speed_string2,"Pay","Fuck off!");
camflash(playerid);
SetTimerEx("resflashed",3000,false,"i",playerid);
IsFlashed[playerid] = 1;
ticket = final_speed_int[playerid]*2;
}
}
}
}
}
if(!IsPlayerInAnyVehicle(playerid))
{
DestroyProgressBar(vhealth[playerid]);
TextDrawSetString(iwt[playerid], " ");
}
//==============================================================================
//Speedcap
//==============================================================================
static
s_iVehicle
;
if ( g_fSpeedCap[ playerid ] != 0.0 && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
s_iVehicle = GetPlayerVehicleID( playerid );
if ( s_iVehicle )
{
static
Float:s_fX,
Float:s_fY,
Float:s_fZ,
Float:s_fVX,
Float:s_fVY,
Float:s_fVZ
;
GetVehiclePos( s_iVehicle, s_fX, s_fY, s_fZ );
GetVehicleVelocity( s_iVehicle, s_fVX, s_fVY, s_fVZ );
if ( !IsPlayerInRangeOfPoint( playerid, g_fSpeedCap[ playerid ] + 0.05, s_fX + s_fVX, s_fY + s_fVY, s_fZ + s_fVZ ) )
{
static
Float:s_fLength
;
s_fLength = floatsqroot( ( s_fVX * s_fVX ) + ( s_fVY * s_fVY ) + ( s_fVZ * s_fVZ ) );
s_fVX = ( s_fVX / s_fLength ) * g_fSpeedCap[ playerid ];
s_fVY = ( s_fVY / s_fLength ) * g_fSpeedCap[ playerid ];
s_fVZ = ( s_fVZ / s_fLength ) * g_fSpeedCap[ playerid ];
if ( s_iVehicle )
SetVehicleVelocity( s_iVehicle, s_fVX, s_fVY, s_fVZ );
else
SetPlayerVelocity( playerid, s_fVX, s_fVY, s_fVZ );
}
}
}
//==============================================================================
//Snake
//==============================================================================
if(SnakeActive[playerid] == 1)
{
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if(ud > 0 && Button[playerid] != 0) Side[playerid]=1;
else if(ud < 0&& Button[playerid] != 1) Side[playerid]=0;
if(lr > 0 && Button[playerid] != 2) Side[playerid]=3;
else if(lr < 0 && Button[playerid] != 3) Side[playerid]=2;
}
//==============================================================================
//Is the player Working Textdraw
//==============================================================================
//==============================================================================
//Speedcap string
//==============================================================================
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid != 0)
{
new speedcap_string[256];
format(speedcap_string,256,"SC: %0.4f", g_fSpeedCap[ playerid ]);
TextDrawSetString(spc[playerid], speedcap_string);
}
else
{
TextDrawSetString(spc[playerid], " ");
}
//==============================================================================
//Speedo
//==============================================================================
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256]/*,final_speed_int*/;
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid != 0)
{
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
final_speed_int[playerid] = floatround(final_speed,floatround_round);
format(speed_string,256,"Speed: %i",final_speed_int);
TextDrawSetString(SPEEDOS[playerid], speed_string);
}
else
{
TextDrawSetString(SPEEDOS[playerid], " ");
}
//==============================================================================
//Seatbelt
//==============================================================================
if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0)
{
new Float:TempCarHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
{
Difference = floatdiv(Difference, 10.0);
new Float:OldHealth2;
GetPlayerHealth(playerid, OldHealth2);
SetPlayerHealth(playerid, floatsub(OldHealth2, Difference));
}
CarHealth[playerid] = TempCarHealth;
}
else
{
CarHealth[playerid] = 0.0; //To aviod that a player dies when he enters a vehicle
}
//==============================================================================
//Bandit Camp Entrance
//==============================================================================
if(IsPlayerInRangeOfPoint(playerid, 8.0, 764.70684814,-1419.41833496,12.53058434))
{
if(gTeam[playerid] == TEAM_BANDIT)
{
MoveObject(banddoorclosed, 771.29498291,-1419.41833496,12.53058434, 2.0);
}
}
else if(!IsPlayerInRangeOfPoint(playerid, 8.0, 764.70684814,-1419.41833496,12.53058434))
{
if(gTeam[playerid] == TEAM_BANDIT)
{
MoveObject(banddoorclosed, 764.70684814,-1419.41833496,12.53058434, 2.0);
}
}
return 1;
}