bool:drift[MAX_PLAYERS]
onplayerconnect:
drift[playerid] = true;
if(listitem == 2)
{
if(drift[playerid] == false)
{
drift[playerid] = true;
TextDrawShowForPlayer(playerid,Chet[playerid]);
SendClientMessage(playerid, -1, "Drift ativado!");
}else{
drift[playerid] = false;
TextDrawHideForPlayer(playerid,Chet[playerid]);
SendClientMessage(playerid, -1, "Drift desativado!");
}
OBS: isso e so a parte do drift nгo peguei todo o dialog do menu que desativa outras text's pois nгo e necessario.
public Drift(playerid) {
new Float:Angle1, Float:Angle2, Float:BySpeed, s[128];
new Float:SpeedX;
for(new g = 0; g < MAX_PLAYERS; g++) {
GetPlayerPos(g, X, Y, Z);
SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(Y,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(Z,SavedPos[ g ][ sZ ])),2)));
Angle1 = ReturnPlayerAngle(g);
Angle2 = GetPlayerTheoreticAngle(g);
BySpeed = floatmul(SpeedX, 12);
if(IsPlayerInAnyVehicle(g) && GetVType(GetPlayerVehicleID(g)) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED) {
if(PlayerDriftCancellation[g] > 0) KillTimer(PlayerDriftCancellation[g]);
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 10;
scores[g]++;
PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 2000, 0, "d", g);
}
if(DriftPointsNow[g] > 0) {
if(scplay[g] == 1) {
TextDrawShowForPlayer(g,Chet[g]);
format(s, sizeof(s), "DRIFT:%d$", DriftPointsNow[g]);
TextDrawSetString(Chet[g], s);
}
}
SavedPos[g][sX] = X;
SavedPos[g][sY] = Y;
SavedPos[g][sZ] = Z;
}
}
=== SOU NOVATO ===
peguei um contador na net mais nгo consigo desativar a textdraw dele alguem pode me ajudar?eu tentei assim fiz um menu aonde desativa outras text's e botei no dialog,mas nгo esta desativando oque eu fiz de errado me disseram que tem que por algo no codigo do drift: mais nгo sei oque eh,sou novo em pawno e to tentando aprender. pawn Код:
pawn Код:
|
public Drift(playerid)
{
new Float:Angle1,
Float:Angle2,
Float:BySpeed,
Float:SpeedX,
s[128];
for(new g = 0; g < MAX_PLAYERS; g++)
{
GetPlayerPos(g, X, Y, Z);
SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(Y,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(Z,SavedPos[ g ][ sZ ])),2)));
Angle1 = ReturnPlayerAngle(g);
Angle2 = GetPlayerTheoreticAngle(g);
BySpeed = floatmul(SpeedX, 12);
if(IsPlayerInAnyVehicle(g) && GetVType(GetPlayerVehicleID(g)) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED)
{
if(PlayerDriftCancellation[g] > 0) KillTimer(PlayerDriftCancellation[g]);
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 10;
scores[g]++;
PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 2000, 0, "d", g);
}
if(DriftPointsNow[g] > 0) {
if(scplay[g] == 1) {
TextDrawShowForPlayer(g,Chet[g]);
SetTimerEx("CancelarDraw",1000,0,"d",g);
format(s, sizeof(s), "DRIFT:%d$", DriftPointsNow[g]);
TextDrawSetString(Chet[g], s);
}
}
SavedPos[g][sX] = X;
SavedPos[g][sY] = Y;
SavedPos[g][sZ] = Z;
}
return 1;
}
public CancelarDraw(playerid){
TextDrawHideForPlayer(playerid,Chet[playerid]);
return 1;
}
if (dialogid == MenuD)
{
if(response)
{
if(listitem == 0)
{
if(vVeloci[playerid] == false)
{
vVeloci[playerid] = true;
PlayerTextDrawShow(playerid, Veloci[playerid]);
SendClientMessage(playerid, VERDE, "< INFO > Velocimetro ativado!");
}else{
vVeloci[playerid] = false;
PlayerTextDrawHide(playerid, Veloci[playerid]);
SendClientMessage(playerid, VERDE, "< INFO > Velocimetro desativado!");
}
}
if(listitem == 1)
{
if(contador[playerid] == false)
{
contador[playerid] = true;
TextDrawShowForPlayer(playerid,Score[playerid]);
SendClientMessage(playerid, VERDE, "< INFO > Score ativado!");
}else{
contador[playerid] = false;
TextDrawHideForPlayer(playerid,Score[playerid]);
SendClientMessage(playerid, VERDE, "< INFO > Score desativado!");
}
}
if(listitem == 2)
{
if(drift[playerid] == false)
{
drift[playerid] = true;
TextDrawShowForPlayer(playerid,Chet[playerid]);
SendClientMessage(playerid, VERDE, "< INFO > Drift ativado!");
return true;
}else{
drift[playerid] = false;
TextDrawHideForPlayer(playerid, Chet[playerid]);
SendClientMessage(playerid, VERDE, "< INFO > Drift desativado!");
return true;
}
}
}
}
alguem pode me ajudar so quero fazer com que desative e ative a textdraw drift: do codigo acima..
|
Sу comente algo relacionado ao assunto, se nгo ia ajudar nгo tinha a necessidade de comentar.
Use TextDrawShowForPlayer pra mostrar a textdraw e TextDrawHideForPlayer pra fazer a textdraw desaparecer. |