SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/05/2018, 10:45 AM   #1
Shadow0707
Little Clucker
 
Join Date: Sep 2016
Posts: 44
Reputation: 0
Default HELP every 5 seconds star when driving in left side

I need help everytime player drives on the left side of the road there should be a gametext that'll show the player that he's driving in the left side and I want the player to get 1 star every 5 seconds on driving in the left side

i've tried it but i failed. (I'm new in scripting sorry)

Code:
forward OnPlayerGhostDriving(playerid, zone, Float:X, Float:Y, Float:Z, Float:A);
public OnPlayerGhostDriving(playerid, zone, Float:X, Float:Y, Float:Z, Float:A)
{
    //Example:
    GameTextForPlayer(playerid, "~r~Drive in the right side of the road !", 1000, 4);
    // Start a 5 second timer to end the Timer
    SetTimerEx("EndTimer", 5000, false, "i", playerid);
    return 1;
}

forward OnPlayerDrivingOnTrainTrack(playerid, zone, Float:X, Float:Y, Float:Z);
public OnPlayerDrivingOnTrainTrack(playerid, zone, Float:X, Float:Y, Float:Z)
{
    //example:
    GameTextForPlayer(playerid, "~r~Do not drive on~n~the train tracks!", 1000, 4);
    SetTimerEx("EndTimer1", 5000, false, "i", playerid);
    return 1;
}
// The timer function - the code to be executed when the timer is called goes here
forward EndTimer(playerid);
public EndTimer(playerid)
{
    if ( GetPlayerWantedLevel(playerid) > 0 ) // If player has 1 or more stars
    {
        GameTextForPlayer(playerid, "~r~Do not drive on~n~the train tracks!", 1000, 4);
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
    }
}
forward EndTimer1(playerid);
// The timer function - the code to be executed when the timer is called goes here
public EndTimer1(playerid)
{
    // Let's notify them also
    GameTextForPlayer(playerid, "~r~Do not drive on~n~the train tracks!", 1000, 4);
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
    return 1;
}
Shadow0707 is offline   Reply With Quote
Old 14/05/2018, 11:03 AM   #2
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 5,978
Reputation: 494
Default Re: HELP every 5 seconds star when driving in left side

This is something that only full high end scripters would attempt really, I'd suggest you start off with something a lot simpler.

What'd you get up to as such? and what were you using?

I notice no usage of the streamer functions, nor natives in checking their real locations.
Sew_Sumi is offline   Reply With Quote
Old 14/05/2018, 11:06 AM   #3
Shadow0707
Little Clucker
 
Join Date: Sep 2016
Posts: 44
Reputation: 0
Default Re: HELP every 5 seconds star when driving in left side

Quote:
Originally Posted by Sew_Sumi View Post
This is something that only full high end scripters would attempt really, I'd suggest you start off with something a lot simpler.

What'd you get up to as such? and what were you using?

I notice no usage of the streamer functions, nor natives in checking their real locations.
I'm using Keep your lane (http://forum.sa-mp.com/showthread.php?t=550986

and he gave this code

Code:
forward OnPlayerGhostDriving(playerid, zone, Float:X, Float:Y, Float:Z, Float:A);
public OnPlayerGhostDriving(playerid, zone, Float:X, Float:Y, Float:Z, Float:A)
{
    //Example:
    GameTextForPlayer(playerid, "~r~Wrong lane!", 1000, 4);
    return 1;
}

forward OnPlayerDrivingOnTrainTrack(playerid, zone, Float:X, Float:Y, Float:Z);
public OnPlayerDrivingOnTrainTrack(playerid, zone, Float:X, Float:Y, Float:Z)
{
    //example:
    GameTextForPlayer(playerid, "~r~Do not drive on~n~the train tracks!", 1000, 4);
    return 1;
}
And i want when player drive in left side of the road the 5 seconds timer start and after the timer's done he'll get 1 star.
Shadow0707 is offline   Reply With Quote
Old 15/05/2018, 12:54 AM   #4
Shadow0707
Little Clucker
 
Join Date: Sep 2016
Posts: 44
Reputation: 0
Default Re: HELP every 5 seconds star when driving in left side

anyone? Sry.
Shadow0707 is offline   Reply With Quote
Old 15/05/2018, 01:06 AM   #5
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 558
Reputation: 73
Default Re: HELP every 5 seconds star when driving in left side

I agree with Sew.

What you are looking for is called nodes. Since there isn't a released code from the thread below (also Gamer_Z removed all his threads and left). This would be extremely hard for someone who doesn't know how, to begin with.

On the bright side, NaS has the lastest nodes possible, could get them from him and play around with it a bit.

http://forum.sa-mp.com/showthread.php?t=564533
ISmokezU is offline   Reply With Quote
Old 15/05/2018, 01:45 AM   #6
Shadow0707
Little Clucker
 
Join Date: Sep 2016
Posts: 44
Reputation: 0
Default Re: HELP every 5 seconds star when driving in left side

Quote:
Originally Posted by ISmokezU View Post
I agree with Sew.

What you are looking for is called nodes. Since there isn't a released code from the thread below (also Gamer_Z removed all his threads and left). This would be extremely hard for someone who doesn't know how, to begin with.?

On the bright side, NaS has the lastest nodes possible, could get them from him and play around with it a bit.

http://forum.sa-mp.com/showthread.php?t=564533
Okay i'll try this and try to edit it a bit thanks i'll update after it.
Shadow0707 is offline   Reply With Quote
Old 15/05/2018, 01:47 AM   #7
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 5,978
Reputation: 494
Default Re: HELP every 5 seconds star when driving in left side

I looked over this last night, there is a function to check if the player is in the zone, but it's quite complicated.


What you will need is a tick timer, and simply have it count up on a variable hooked to the player (Will be an array) and simply count up if continuing to drive on the wrong side of the road. Once it hits 5, it'll then have to add the star.

You can then ignore that player by checking in that star giving check, whether they have a wanted level.

Making a 5 second timer attached to the player will make them wanted, or looked at, even if they started driving properly.


That include, is actually quite impressive,as well as the other releases that have covered this.
Sew_Sumi is offline   Reply With Quote
Old 16/05/2018, 03:35 AM   #8
Shadow0707
Little Clucker
 
Join Date: Sep 2016
Posts: 44
Reputation: 0
Default Re: HELP every 5 seconds star when driving in left side

I've removed it cuz it's bugging my script and I have a new problem with textdraws i don't know much with textdraws



here's the code

The line at the top

Code:
Convoys_Init()
{
	for (new i; i < MAX_CONVOYS; i++)
	{
		AConvoys[i][ConvoyTextLeader] = TextDrawCreate(320.0, 1.0, " "); // Create the textdraw for the leader
		TextDrawSetShadow(AConvoys[i][ConvoyTextLeader], 1); // Reduce the shadow to 1
		TextDrawAlignment(AConvoys[i][ConvoyTextLeader], 2); // Align the convoy-infobar to the center for the leader
		TextDrawUseBox(AConvoys[i][ConvoyTextLeader], 1); // Set the missiontext to display inside a box
		TextDrawBoxColor(AConvoys[i][ConvoyTextLeader] ,0x00000066); // Set the box color of the missiontext
		TextDrawLetterSize(AConvoys[i][ConvoyTextLeader], 0.3, 0.8); // Set Letter Size
		TextDrawFont(AConvoys[i][ConvoyTextLeader], 2); // Set the font

		AConvoys[i][ConvoyTextMember] = TextDrawCreate(320.0, 1.0, " "); // Create the textdraw for the members
		TextDrawSetShadow(AConvoys[i][ConvoyTextLeader], 1); // Reduce the shadow to 1
		TextDrawAlignment(AConvoys[i][ConvoyTextMember], 2); // Align the convoy-infobar to the center for the members
		TextDrawUseBox(AConvoys[i][ConvoyTextMember], 1); // Set the missiontext to display inside a box
		TextDrawBoxColor(AConvoys[i][ConvoyTextMember] ,0x00000066); // Set the box color of the missiontext
		TextDrawLetterSize(AConvoys[i][ConvoyTextMember], 0.3, 0.8); // Set Letter Size
		TextDrawFont(AConvoys[i][ConvoyTextMember], 2); // Set the font
	}
}

The 2 lines below is speedometere
Code:
    Speedometer_Setup(playerid)
    {
            // Setup the speedometer for the player
            APlayerData[playerid][SpeedometerText] = TextDrawCreate(500.0, 389.0, " ");
            TextDrawFont(APlayerData[playerid][SpeedometerText], 2);
            TextDrawLetterSize(APlayerData[playerid][SpeedometerText], 0.350000, 1.500000);
            TextDrawColor(APlayerData[playerid][SpeedometerText], -1);
            TextDrawSetShadow(APlayerData[playerid][SpeedometerText], 0);
            TextDrawUseBox(APlayerData[playerid][SpeedometerText], 1);
            TextDrawBoxColor(APlayerData[playerid][SpeedometerText], 0x00000066);
            APlayerData[playerid][FuelGauge] = TextDrawCreate(500.0, 409.0, " ");
            TextDrawFont(APlayerData[playerid][FuelGauge], 2);
            TextDrawLetterSize(APlayerData[playerid][FuelGauge], 0.350000, 1.500000);
            TextDrawColor(APlayerData[playerid][FuelGauge], -1);
            TextDrawSetShadow(APlayerData[playerid][FuelGauge], 0);
            TextDrawUseBox(APlayerData[playerid][FuelGauge], 1);
            TextDrawBoxColor(APlayerData[playerid][FuelGauge], 0x00000066);
            // Enable the TextDraw for this player
            TextDrawShowForPlayer(playerid, APlayerData[playerid][SpeedometerText]);
            TextDrawShowForPlayer(playerid, APlayerData[playerid][FuelGauge]);

            // Start the speedometer timer
            APlayerData[playerid][SpeedometerTimer] = SetTimerEx("Speedometer_Update", 100, true, "i", playerid);

            return 1;
    }
Shadow0707 is offline   Reply With Quote
Old 16/05/2018, 07:20 AM   #9
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 5,978
Reputation: 494
Default Re: HELP every 5 seconds star when driving in left side

With textdraws, it's 640x480 is the size of the screen, so you want to look for a TextDrawCreate that is made up in the top left at 0,0, and the other bottom right ones will be near 600x440 or something.


You'll just have to find them, as they're likely to be linked to something else and because that isn't working, or that it's been editted wrong, it'll stop it from being taken off the screen.
Sew_Sumi is offline   Reply With Quote
Old 16/05/2018, 08:20 AM   #10
Shadow0707
Little Clucker
 
Join Date: Sep 2016
Posts: 44
Reputation: 0
Default Re: HELP every 5 seconds star when driving in left side

Quote:
Originally Posted by Sew_Sumi View Post
With textdraws, it's 640x480 is the size of the screen, so you want to look for a TextDrawCreate that is made up in the top left at 0,0, and the other bottom right ones will be near 600x440 or something.


You'll just have to find them, as they're likely to be linked to something else and because that isn't working, or that it's been editted wrong, it'll stop it from being taken off the screen.
Is it possible to put 2 textdraws in 1 box only ? show me a sample code.
Shadow0707 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Derby Traine - 40 Seconds of fast driving AlieN1995 Screenshots and Videos 1 28/02/2017 03:45 PM
[FilterScript] Detect Driving on the wrong side of the road cessil Filterscripts 21 28/05/2015 03:49 AM
Detecting driving on the wrong side cessil Screenshots and Videos 16 23/02/2015 11:45 PM
[HELP] The tram is driving on the wrong street side! Pasa Scripting Help 2 02/01/2013 06:19 PM
Making camera look from left side to player AiVAMAN Help Archive 2 14/02/2010 07:23 AM


All times are GMT. The time now is 08:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.