Register

If you already have an account with us, please use the login panel below to access your account.

Results 1 to 11 of 11
  1. #1
    Retired Administrator Hyder's Avatar
    Join Date
    Feb 2011
    Posts
    2,014
    In-Game Name(s)
    Hyder King
    Post Thanks / Like

    [ Scripting Help ] How to script /enter and /exit for custom Int including vehicle

    Like there's a garage under the cummings building, we /enter and go down there, and /exit with a vehicle, how do I script that?

    I tried google and youtube but nothing worked.

    Thanks in advance :]

  2. #2
    Retired Administrator
    byt3's Avatar
    Join Date
    Oct 2011
    Age
    35
    Posts
    1,901
    In-Game Name(s)
    byt3
    Post Thanks / Like
    Former Head Administrator
    Former Lead Developer
    Programmer/Web Developer
    SA-MP Scripter since 2008


    Tonight, tonight! Off with his head!

  3. Thanks Hyder thanked for this post
    Likes Andrei_Eduard liked this post
  4. #3
    Retired Administrator Hyder's Avatar
    Join Date
    Feb 2011
    Posts
    2,014
    In-Game Name(s)
    Hyder King
    Post Thanks / Like
    Thanks for that Byte, It'd be better if you could give the direct link to what I actually want :)
    But still thanks ;]
    Playing CSGO, VM me your ID so we can play :D
    Talk to me if you want the surname


    HTML Code:
     old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]


    Updated
    Spoiler!

  5. #4
    3 Year Veteran 500 Posts500 Posts Jason Rekram's Avatar
    Join Date
    Sep 2012
    Location
    New York
    Posts
    1,279
    In-Game Name(s)
    Jason_Rekram
    Post Thanks / Like
    Do you just want the code or are you intrested in how to do it?

    [2/20/2014 11:05:59 PM] SWEETY: im sorry i gagged on ur dads dick
    Current Level: 22
    Ex-LSPD R4(TDB(Founded)/T&R) || Ex-LSPD R4(HSIU/IA/PWC/ADM/TDB) || Ex-SANG R4(RnT Commander/IA) || FBI R2(CID/NSB) || Ex-LSFMD R0 || Beta-Tester, NA Recruitment || Community Helper
    [spoiler]The original TDB.

    http://www.youtube.com/watch?v=0cgOt...layer_embedded[/spoiler]
    vBy :MILK:v

  6. #5
    Retired Administrator Hyder's Avatar
    Join Date
    Feb 2011
    Posts
    2,014
    In-Game Name(s)
    Hyder King
    Post Thanks / Like
    Quote Originally Posted by Jason Rekram View Post
    Do you just want the code or are you intrested in how to do it?
    I found on how to do it, but the vehicle part, I'm starting to search for it, after scripting the /enter and /exit I get a problem, no other command works, like /time etc.

    I don't know if its problem with the test server only, still trying stuff.
    Playing CSGO, VM me your ID so we can play :D
    Talk to me if you want the surname


    HTML Code:
     old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]


    Updated
    Spoiler!

  7. #6
    3 Year Veteran 500 Posts500 Posts Jason Rekram's Avatar
    Join Date
    Sep 2012
    Location
    New York
    Posts
    1,279
    In-Game Name(s)
    Jason_Rekram
    Post Thanks / Like
    K gimmi a sec in the movies(2 guns :D)

    [2/20/2014 11:05:59 PM] SWEETY: im sorry i gagged on ur dads dick
    Current Level: 22
    Ex-LSPD R4(TDB(Founded)/T&R) || Ex-LSPD R4(HSIU/IA/PWC/ADM/TDB) || Ex-SANG R4(RnT Commander/IA) || FBI R2(CID/NSB) || Ex-LSFMD R0 || Beta-Tester, NA Recruitment || Community Helper
    [spoiler]The original TDB.

    http://www.youtube.com/watch?v=0cgOt...layer_embedded[/spoiler]
    vBy :MILK:v

  8. Likes Destiny liked this post
  9. #7
    Retired Administrator Hyder's Avatar
    Join Date
    Feb 2011
    Posts
    2,014
    In-Game Name(s)
    Hyder King
    Post Thanks / Like
    Got /enter and /exit working, and other commands work as well, now vehicle part, I can't find it, so tell me what to add in script so if I /enter or /exit, I stay on vehicle :]
    Playing CSGO, VM me your ID so we can play :D
    Talk to me if you want the surname


    HTML Code:
     old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]


    Updated
    Spoiler!

  10. #8
    Chartered Old-School Legend
    Beta Team Founder
    Development Team
    500 Posts500 Posts James's Avatar
    Join Date
    May 2010
    Age
    33
    Posts
    1,293
    In-Game Name(s)
    James_Williamson
    Post Thanks / Like
    Doing vehicles, is a little bit of a tricky part, especially when you also wanna work with virtual worlds (as I did with my garage system.)

    So - first off all, you need to know if the player is in a vehicle or not - we'll approach this simply and efficient by the following code: (ZCMD based)

    Code:
    CMD:enter(playerid, params[]){
           if(IsPlayerConnected(playerid)){
                  if(IsPlayerInAnyVehicle(playerid)){
                         //A.K.A: The player is trying to enter the point while in a vehicle.
                  }else{
                         //The player is not inside any vehicle, and we just set him at the wanted position.
                  }
           }
    }
    So, basically we know if the player is in a vehicle or not - after that, it's familair to the normal enter/exit method, except for some things, check it out.

    Code:
    CMD:enter(playerid, params[]){
           if(IsPlayerConnected(playerid)){
                  if(IsPlayerInAnyVehicle(playerid)){
                         new vhid = GetPlayerVehicleID(playerid);
                         SetVehiclePos(vhid, x, y, z); //x, y, and z should be overwritten by the wanted position.
                  }else{
                         //The player is not inside any vehicle, and we just set him at the wanted position.
                  }
           }
    }
    There we go, thats all we need to do. (Quick note: The SetVehiclePos will also take the players which are in the vehicle along with it - so no need to worry about that.)

    Lil' extension - if you wanna work with virtual words, this'll take a lil bit longer - i'll write this done, just incase you are interested.

    Code:
    CMD:enter(playerid, params[]){
           if(IsPlayerConnected(playerid)){
                  if(IsPlayerInAnyVehicle(playerid)){
                         new vhid = GetPlayerVehicleID(playerid);
                         SetVehiclePos(vhid, x, y, z);
                         SetVehicleVirtualWorld(vhid, vw); //vw has to be overwritten by the wanted vw ofcourse.
                         for(p = 0; p < MAX_PLAYERS; p++){
                                 if(IsPlayerConnected(p)){
                                        if(IsPlayerInAnyVehicle(p)){
                                               if(GetPlayerVehicleID(playerid) == vhid){
                                                       SetPlayerVirtualWorld(playerid, vw); //vw has to be overwritten by the wanted vw.
                                               }
                                        }
                                 }
                         }
                  }else{
                         //The player is not inside any vehicle, and we just set him at the wanted position.
                  }
           }
    }
    NOTE: I heavly suggest you to use the Foreach loops by YLess, check it out - it's a better and faster way of looping through vehicles and players.

    That's it - you can also work with interiors if you like, but i'm not gonna write this all down if you aint using it.

    Codes were written out of my head, if anything is not working, feel free to vm/pm me same for any more help or trouble you are experiencing.
    Last edited by James; 5th August 2013 at 03:51 PM.
    Spoiler!

  11. Thanks Watson thanked for this post
  12. #9
    Discord Manager
    Retired Executive Administrator
    Watson's Avatar
    Join Date
    Sep 2012
    Location
    Romania
    Posts
    10,286
    In-Game Name(s)
    Watson
    Post Thanks / Like
    Awaiting player's response for 24 hours.
    If anyone needs me, I'm most likely on discord.


    Spoiler!


    "The truth is like poetry-- And most people fucking hate poetry," - Overheard in a Washington D.C. bar by Michael Lewis, author of The Big Short


    <iframe width="560" height="315" src="https://www.youtube.com/embed/hNMZGSzB7EI" frameborder="0" allowfullscreen></iframe>

  13. #10
    Retired Administrator Hyder's Avatar
    Join Date
    Feb 2011
    Posts
    2,014
    In-Game Name(s)
    Hyder King
    Post Thanks / Like
    You may close this, thanks Byte and James for your time.
    I'm gonna try these things out. :]
    Playing CSGO, VM me your ID so we can play :D
    Talk to me if you want the surname


    HTML Code:
     old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]


    Updated
    Spoiler!

  14. #11
    Discord Manager
    Retired Executive Administrator
    Watson's Avatar
    Join Date
    Sep 2012
    Location
    Romania
    Posts
    10,286
    In-Game Name(s)
    Watson
    Post Thanks / Like
    Answered and archived.
    If anyone needs me, I'm most likely on discord.


    Spoiler!


    "The truth is like poetry-- And most people fucking hate poetry," - Overheard in a Washington D.C. bar by Michael Lewis, author of The Big Short


    <iframe width="560" height="315" src="https://www.youtube.com/embed/hNMZGSzB7EI" frameborder="0" allowfullscreen></iframe>

  15. Likes Hyder liked this post
 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Click to connect to Discord (San Andreas Roleplay)Click to go to the official San Andreas Multiplayer websiteDownload Teamspeak