SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/09/2018, 02:00 AM   #1
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,752
Reputation: 14
Default Hidden Trailers Save

How can i store hidden trailers inside MySQL. When you put up the hidden trailer it will have a message saying
"You already use this trailer, Find another one to use". and you can't use it again.

Code:
new thidden[25];

    thidden[0] = CreateVehicle(591,2296.66479492,-1695.09020996,14.25414467,179.32501221,0,0,150000); //Trailer 3
    thidden[1] = CreateVehicle(591,1100.88671875,-820.34722900,87.64498901,90.36413574,0,0,150000); //Trailer 3
    thidden[2] = CreateVehicle(591,156.06054688,-1960.29003906,4.47311258,269.04968262,0,0,150000); //Trailer 3
    thidden[3] = CreateVehicle(591,867.93475342,-595.09338379,18.88192177,90.36254883,0,0,150000); //Trailer 3
    thidden[4] = CreateVehicle(591,1027.16662598,157.10098267,30.46110344,84.40759277,0,0,150000); //Trailer 3
    thidden[5] = CreateVehicle(591,979.31634521,-48.72017288,79.97157288,106.23742676,0,0,150000); //Trailer 3
    thidden[6] = CreateVehicle(591,-1107.37683105,-1630.90722656,77.07361603,269.26727295,0,0,150000); //Trailer 3
    thidden[7] = CreateVehicle(591,-378.79687500,-1445.32617188,26.42623711,4.76806641,0,0,150000); //Trailer 3
    thidden[8] = CreateVehicle(591,-1788.20458984,-1605.11499023,22.47261620,6.70397949,0,0,150000); //Trailer 3
    thidden[9] = CreateVehicle(591,-2258.96191406,-1693.13671875,481.28280640,44.41772461,0,0,150000); //Trailer 3
    thidden[10] = CreateVehicle(591,-1941.93469238,-1080.12377930,31.47755241,354.79162598,0,0,150000); //Trailer 3
    thidden[11] = CreateVehicle(591,-2377.48730469,-570.46386719,130.21121216,50.36682129,0,0,150000); //Trailer 3
    thidden[12] = CreateVehicle(591,-2107.27148438,982.73730469,72.21530151,354.78698730,0,0,150000); //Trailer 3
    thidden[13] = CreateVehicle(591,-2505.00781250,1162.33300781,55.98873901,90.37902832,0,0,150000); //Trailer 3
    thidden[14] = CreateVehicle(591,-2625.48974609,2254.78857422,8.84631538,0.00000000,0,0,150000); //Trailer 3
    thidden[15] = CreateVehicle(591,554.62280273,2886.27734375,4.92820978,100.33489990,0,0,150000); //Trailer 3
    thidden[16] = CreateVehicle(591,-732.79101562,2896.36523438,41.72669601,167.36572266,0,0,150000); //Trailer 3
    thidden[17] = CreateVehicle(591,-711.55273438,2327.66015625,127.93330383,320.75134277,0,0,150000); //Trailer 3
    thidden[18] = CreateVehicle(591,2894.24316406,1613.18908691,11.51998711,1.13208008,0,0,150000); //Trailer 3
    thidden[19] = CreateVehicle(591,1428.05957031,2816.85546875,11.51998711,301.58020020,0,0,150000); //Trailer 3
    thidden[20] = CreateVehicle(591,1333.29675293,1644.08947754,11.51998711,1.13159180,0,0,150000); //Trailer 3
    thidden[21] = CreateVehicle(591,1048.11926270,1354.99621582,11.51998711,269.41662598,0,0,150000); //Trailer 3
    thidden[22] = CreateVehicle(591,593.40454102,902.22967529,-44.05310822,269.41223145,0,0,150000); //Trailer 3
    thidden[23] = CreateVehicle(591,151.83856201,1828.10803223,18.34773254,269.41223145,0,0,150000); //Trailer 3
    thidden[24] = CreateVehicle(591,125.48730469,1339.46386719,11.28561211,269.41223145,0,0,150000); //Trailer 3
Code:
forward HiddenTrailerMissions(playerid);
public HiddenTrailerMissions(playerid)
{
    if (GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 591)
    {
        new message[100];
        SetPlayerCheckpoint(playerid, -1073.4313, -1306.4890, 129.2188, 10);
        SendClientMessage(playerid, HIDDEN, "You have found a hidden trailer!");
        SendClientMessage(playerid, HIDDEN, "Deliver it to 'The Den'");
        format(message,sizeof(message), "~w~Deliver the ~y~hidden trailer ~w~to ~r~the den");
        PlayerTextDrawSetString(playerid, work[playerid], message);
        print("CALL 1");
        onCheck[playerid] = true;
        HiddenTrailer_PlayerJob[playerid] = 1;
        KillTimer(htimer);
    }
    return 1;
}
__________________
Working on a Trucking Server from scratch.
There are cool features, like /workmenu /convoy /pay(When Police Officer asked you for a fine) and more etc.
DerickClark is offline   Reply With Quote
Old 09/09/2018, 06:46 AM   #2
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,244
Reputation: 525
Default Re: Hidden Trailers Save

You need to do a for loop checking that the trailer is actually in thidden[], rather than simply going off the model of the trailer.

If you're only going to use the model, then all the thidden[] is a waste.


A better way to actually do this, would be using foreach, and its iterators.
Sew_Sumi is offline   Reply With Quote
Old 09/09/2018, 07:09 AM   #3
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,752
Reputation: 14
Default Re: Hidden Trailers Save

Quote:
Originally Posted by Sew_Sumi View Post
You need to do a for loop checking that the trailer is actually in thidden[], rather than simply going off the model of the trailer.

If you're only going to use the model, then all the thidden[] is a waste.


A better way to actually do this, would be using foreach, and its iterators.
Thank you. will try that.
__________________
Working on a Trucking Server from scratch.
There are cool features, like /workmenu /convoy /pay(When Police Officer asked you for a fine) and more etc.
DerickClark 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
OnPlayerEnterCheckpoint not called for hidden trailers DerickClark Scripting Help 3 20/08/2018 05:05 PM
Hidden Antoniohl Scripting Help 9 23/07/2015 03:20 AM
[AJUDA] Como dou save em Trailers? GuikBretas Português/Portuguese 1 08/04/2011 12:53 PM
/hidden Criss_Angel Help Archive 15 28/10/2010 03:54 PM
NPC Trailers Mattjones17 Help Archive 3 27/11/2009 06:54 PM


All times are GMT. The time now is 02:13 PM.


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