Speed Limiter help
#1

Hey i got this script , can anyone know how to make , texdraw for it SPEEDLIMIT:ON
and if release ctrl iґthen i goes Speedlimitff
PHP код:
    / -----------------------------------------------------------------------------
    
// -----------------------------------------------------------------------------
    // Cruise Control FilterScript for SAMP 0.3
    // 4th March 2010 (My birthday :)
    // By Mick88
    // Visit my server:
    // Convoy Trucking (Cruise Control implemented)
    // 91.204.163.105:7931
    // -----------------------------------------------------------------------------
    // -----------------------------------------------------------------------------
     
    #include <a_samp>
     
    #define COLOR_MESSAGE_YELLOW 0xFFDD00AA
    #define COLOR_GREY 0xAFAFAFAA
     
     
    
new Float:PlayerCruiseSpeed[MAX_PLAYERS];
    new 
Float:PlayerHeadingAngle[MAX_PLAYERS];
    new 
CCKey KEY_ACTION//Cruise Control Key - change this if you need
    /*  keys that can be used:
            KEY_ACTION (LCTRL)
            KEY_FIRE (mouse click)
            KEY_SUBMISSION (2)
            KEY_LOOK_BEHIND
            or others you know
    */
     
    
forward CruiseControl(playerid);
     
    public 
OnFilterScriptInit()
    {
            print(
"[Cruise Control system by Mick88: LOADED]");
            return 
1;
    }
     
    public 
OnFilterScriptExit()
    {
            return 
1;
    }
     
    public 
OnPlayerCommandText(playeridcmdtext[])
    {
        new 
cmd[256];
            new 
idx;
           
            
cmd strtok(cmdtextidx);
           
            if (
strcmp(cmd"/cruisecontrol"true) == 0)
            {
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW":: Cruise Control by mick88 ::");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*Cruise control will help you keep constant speed without the need of tapping the acceleration key");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*To use it, set your  car to wanted speed and hold the Cruise Control button (default: LCTRL)");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*Your vehicle will keep that speed regardless of going up hill or downhill as long as Cruise Control");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"button is held down. You can release the acceleration button.");
            return 
1;
        }
            return 
0;
    }
     
    public 
OnPlayerConnect(playerid)
    {
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"* Cruise Control by mick88 - type /CruiseControl for more info");
            return 
1;
    }
     
    public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
    {
            if ((
newkeys CCKey) && !(oldkeys CCKey) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                new 
vid GetPlayerVehicleID(playerid);
                    if (
GetVehicleSpeed(vid) == 0) return false;
                    new 
Float:xFloat:yFloat:z;
                    
GetVehicleVelocity(vidxyz);
                    
GetVehicleZAngle(vidPlayerHeadingAngle[playerid]);
                    
DistanceFlat(00xyPlayerCruiseSpeed[playerid]);
                
SetTimerEx("CruiseControl"500false"d"playerid);
                
SendClientMessage(playeridCOLOR_GREY"* Cruise control engaged"); // === Remove this if not needed ===
            
}
            else if (
PlayerCruiseSpeed[playerid] != 0.00 && (newkeys KEY_HANDBRAKE))
            {
                
PlayerCruiseSpeed[playerid] = 0.00;
            }
            return 
1;
    }
     
    
GetVehicleSpeed(vehicleid)
    {
            new 
Float:VxFloat:VyFloat:Vz;
            
GetVehicleVelocity(vehicleidVxVyVz);
        new 
Float:rtn;
        
rtn floatsqroot(floatpower(Vx*100,2) + floatpower(Vy*100,2));
        
rtn floatsqroot(floatpower(rtn,2) + floatpower(Vz*100,2));
        return 
floatround(rtn);
    }
     
    
DistanceFlat(Float:axFloat:ayFloat:bx,Float:by, &Float:distance)
    {
            
distance floatsqroot(floatpower(bx-ax,2)+floatpower(by-ay,2));
            return 
floatround(distance);
    }
     
    public 
CruiseControl(playerid)
    {
        new 
vid GetPlayerVehicleID(playerid);
        new 
Float:xFloat:yFloat:z;
            
GetVehicleVelocity(vidxyz);
     
            new 
keysudlr;
            
GetPlayerKeys(playeridkeysudlr);
     
            new 
Float:angleFloat:headingFloat:speed;
            
GetVehicleZAngle(vidangle);
            
GetVehicleHeadingAngle(vidheading);
            
DistanceFlat(00xyspeed);
     
     
            if (!(
keys CCKey) || PlayerCruiseSpeed[playerid] == 0.00 || //If player released LCTRL or CruiseSpeed got cancelled by other means (spacebar press)
            
GetPlayerState(playerid) != PLAYER_STATE_DRIVER ||
            (
speed 0.7 PlayerCruiseSpeed[playerid]) || //if player slowed down too much
            
|| //if car is going upwards too fast
            
(floatabs(angle heading) > 50 && floatabs(angle heading) < 310))//if vehicle goes sideways
            
{                                   //Cruise control will turn off:
                
PlayerCruiseSpeed[playerid] = 0.00;
                
SendClientMessage(playeridCOLOR_GREY"*Cruse control disengaged"); // === Remove this if not needed ===
                    
return false;
            }
            
GetVehicleZAngle(vidPlayerHeadingAngle[playerid]);
            
GetXYVelocity(vidxyPlayerCruiseSpeed[playerid]);
            
SetVehicleVelocity(vidxyz);
            return 
SetTimerEx("CruiseControl"500false"d"playerid);
    }
     
    
GetXYVelocity(vehicleid, &Float:x, &Float:yFloat:speed)
    {
            new 
Float:a;
            
0.0;
            
0.0;
            
GetVehicleZAngle(vehicleida);
            
+= (speed floatsin(-adegrees));
            
+= (speed floatcos(-adegrees));
    }
     
    
GetAngleToXY(Float:XFloat:YFloat:CurrentXFloat:CurrentY, &Float:Angle)
    {
        
Angle atan2(Y-CurrentYX-CurrentX);
        
Angle floatsub(Angle90.0);
        if(
Angle 0.0Angle floatadd(Angle360.0);
    }
     
    
GetVehicleHeadingAngle(vehicleid, &Float:a)
    {
            new 
Float:xFloat:yFloat:z;
            
GetVehicleVelocity(vehicleidxyz);
            
GetAngleToXY(xy00a);
    }
     
    
strtok(const string[], &index)
    {
            new 
length strlen(string);
            while ((
index length) && (string[index] <= ' '))
            {
                    
index++;
            }
     
            new 
offset index;
            new 
result[20];
            while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
            {
                    
result[index offset] = string[index];
                    
index++;
            }
            
result[index offset] = EOS;
            return 
result;
    } 
Reply
#2

any
Reply
#3

http://forum.sa-mp.com/showthread.ph...82#post2650782
Reply
#4

wont work for me ur fs
Reply
#5

jus need dexdraw
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)