Vehicle TP
#1

Hello. its my 2nd post here.
I just need help with a Vehicle create and tp it


I want to make a vip car for freeroom server

new VIPvehicle;
VIPvehicle = CreateVehicle(model.....)

now with cmd
/vc


i need it to be already create at a place and add objects for it(Ex Vehicle and Ex objects)

then when i type /vc it teleport to me

GetPlayerPos
SetVehiclePos


with msg "Welcome to ur VIP Car"

I need it just for one name "AnyName"

If else then "Its AnyName's VIP Car if u need noe please ask admins"

all of that at FilterScript

I just compile and add it to my server

Thnx.
Reply
#2

Heeeeeeello there!
If you want someone script for you, it's the wrong section here.
Do you want create the script of your 'freeroom server' ? Or you can find some gamemode here : http://forum.sa-mp.com/forumdisplay.php?f=71
Reply
#3

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Heeeeeeello there!
If you want someone script for you, it's the wrong section here.
Do you want create the script of your 'freeroom server' ? Or you can find some gamemode here : http://forum.sa-mp.com/forumdisplay.php?f=71
I just want to know how to tp the vehicle to a new pos

Then if there is any place to ask about FilterScripts tgen please send me the link

Isn't this is "Scripting Help"??

I dont have a server i just want to learn Scripting.

Anyway thnx. +REP for u
Reply
#4

GrandLarcenys VSpawner script does some of this...
Reply
#5

Quote:
Originally Posted by oktokt1
Посмотреть сообщение
I just want to know how to tp the vehicle to a new pos

Then if there is any place to ask about FilterScripts tgen please send me the link

Isn't this is "Scripting Help"??

I dont have a server i just want to learn Scripting.

Anyway thnx. +REP for u
Alright, that's not the same thing. You want script something. I will try to help you then.

PHP код:
#define COLOR_RED 0xff0000FF // We define COLOR_RED as an hexadecimal color (red)
#define COLOR_GREEN 0x33cc33FF // We define COLOR_GREEN as an hexadecimal color (green)
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/tp"cmdtexttrue) == 0// If the player type /tp than we executes thos following lines
    
{
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"You must be in a vehicle!"); // If the player isn't in a vehicle then we return an error message! The command stopping here if the player isn't in a vehicle
        
vehicleid GetPlayerVehicleID(playerid); // We get back the ID of player's vehicle (useful for later)
        
SetVehiclePos(vehicleidxyz);
/*We set the vehicle at the coordinates x, y, z. You HAVE TO CHANGE x, y, z by coordinates like -1964.8184, 253.4444, 47.7031 (Wangs Car roof)*/
        
PutPlayerInVehicle(playeridvehicleid0);
/*We put the player in the vehicle at the seat 0. Why? Seat = driver0 - Driver
1 - Front passenger
2 - Back-left passenger
3 - Back-right passenger
4+ - Passenger seats (coach etc.)*/
        
SendClientMessage(playeridCOLOR_GREEN"You have been teleported!"); // We send a basic message to say the player has been teleported
        
return 1;
    }
    return 
0;

Reply
#6

PHP код:
SendClientMessage(playeridCOLOR_GREEN"Your VIP vehicle has arrived!"); 
But also he wanted the vehicle to be created as well. Not just teleing a vehicle to them.
Reply
#7

I made a mistake, forget to put 'new'.

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
yea, that first \ really looked odd to me simply being out of the string.
Alright, this one is better ?
PHP код:
#include <a_samp>
#define COLOR_RED 0xff0000FF // We define COLOR_RED as an hexadecimal color (red)
#define COLOR_GREEN 0x33cc33FF // We define COLOR_GREEN as an hexadecimal color (green)
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/tp"cmdtexttrue) == 0// If the player type /tp than we executes thos following lines
    
{
        
CreateVehicle(4111111, -1, -110000);
        
/* Replace 411 by the vehicle's model you want | -1 is a random color | Primary and secondary color
        Link can be fin here : https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List */
        
new vehicleid GetPlayerVehicleID(playerid); // We get back the ID of player's vehicle (useful for later)
        
SetVehiclePos(vehicleidxyz);
        
/*We set the vehicle at the coordinates x, y, z. You HAVE TO CHANGE x, y, z by coordinates like -1964.8184, 253.4444, 47.7031 (Wangs Car roof)*/
        
PutPlayerInVehicle(playeridvehicleid0);
        
/*We put the player in the vehicle at the seat 0. Why? Seat = driver
        0 - Driver
        1 - Front passenger
        2 - Back-left passenger
        3 - Back-right passenger
        4+ - Passenger seats (coach etc.)*/
        
SendClientMessage(playeridCOLOR_GREEN"You have been teleported!"); // We send a basic message to say the player has been teleported
        
return 1;
    }
    return 
0;

-- I don't know how to include parameter in this way. :$

But.. there is an example with using the include sscanf (LINK) and zcmd (LINK).

PHP код:
#include <a_samp>
#include <ssanf>
#include <zcmd>
#define COLOR_RED 0xff0000FF // We define COLOR_RED as an hexadecimal color (red)
#define COLOR_GREEN 0x33cc33FF // We define COLOR_GREEN as an hexadecimal color (green)
CMD:tp(playeridparams[])
{
    new 
model;
    if(
sscanf(params"i"model) return SendClientMessage(playeridCOLOR_GREEN"/v [model_id] [400-611]");
    
/*If the parameter 'model' isn't define by the player (ex: he type /v), we send to him a message to make him know what he should do.
    The model to be between 400-611 (Check : https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List */
    
    
if(611 model || model 400) return SendClientMessage(playeridCOLOR_RED"[SYSTEM] Invalid ID [400-611]");
    
/* If the model isn't between 400-611 (ex: /v 99999, send to the player an error message. '||' mean OR. */
    
    
CreateVehicle(model1111, -1, -110000);
    
/* CreateVehicle(modelOfTheVehicle, Coordinate x, Coordinate y, Coordinate z, rotation of the vehicle, Primary color (-1 is random), Secondary color (-1 is random, respawn delay (in ms));
    Check this : https://sampwiki.blast.hk/wiki/CreateVehicle */
    
    
new vehicleid GetPlayerVehicleID(playerid); // We get back the ID of player's vehicle (useful for later)
    
SetVehiclePos(vehicleidxyz);
    
/*We set the vehicle at the coordinates x, y, z. You HAVE TO CHANGE x, y, z by coordinates like -1964.8184, 253.4444, 47.7031 (Wangs Car roof)*/
    
PutPlayerInVehicle(playeridvehicleid0);
    
/*We put the player in the vehicle at the seat 0. Why? Seat = driver
    0 - Driver
    1 - Front passenger
    2 - Back-left passenger
    3 - Back-right passenger
    4+ - Passenger seats (coach etc.)*/
    
     
SendClientMessage(playeridCOLOR_GREEN"You have been teleported!"); // We send a basic message to say the player has been teleported
      
return 1// Return 1 to terminate the command

Reply
#8

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Alright, that's not the same thing. You want script something. I will try to help you then.

PHP код:
#define COLOR_RED 0xff0000FF // We define COLOR_RPutPlayerInVehicleED as an hexadecimal color (red)
#define COLOR_GREEN 0x33cc33FF // We define COLOR_GREEN as an hexadecimal color (green)
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/tp"cmdtexttrue) == 0// If the player type /tp than we executes thos following lines
    
{
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"You must be in a vehicle!"); // If the player isn't in a vehicle then we return an error message! The command stopping here if the player isn't in a vehicle
        
vehicleid GetPlayerVehicleID(playerid); // We get back the ID of player's vehicle (useful for later)
        
SetVehiclePos(vehicleidxyz);
/*We set the vehicle at the coordinates x, y, z. You HAVE TO CHANGE x, y, z by coordinates like -1964.8184, 253.4444, 47.7031 (Wangs Car roof)*/
        
PutPlayerInVehicle(playeridvehicleid0);
/*We put the player in the vehicle at the seat 0. Why? Seat = driver0 - Driver
1 - Front passenger
2 - Back-left passenger
3 - Back-right passenger
4+ - Passenger seats (coach etc.)*/
        
SendClientMessage(playeridCOLOR_GREEN"You have been teleported!"); // We send a basic message to say the player has been teleported
        
return 1;
    }
    return 
0;


I want to do CreateVehicle Be4 That cmd and a new Vehicle pos will be GetPlayerPos Then SetVehiclePos I think it will be with New X Y Z it's back to GetPlayerPos then PutPlayerInVehicle.






I want to know how to +Rep u guys u helped me alot
Reply
#9

Quote:
Originally Posted by oktokt1
Посмотреть сообщение
I want to do CreateVehicle Be4 That cmd and a new Vehicle pos will be GetPlayerPos Then SetVehiclePos I think it will be with New X Y Z it's back to GetPlayerPos then PutPlayerInVehicle.

I want to know how to +Rep u guys u helped me alot
Without using zcmd/sscanf, I don't know how to put parameters! Apologize.
I misunderstood what you wanted.

Take a look :
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp(cmdtext"/tp"true) == 0// If the player type /tp than we executes thos following lines
    
{
        new 
Float:xFloat:yFloat:zFloat:Angle;
        
/* 4 variables : x, y, z, angle for create the vehicle at player's coordinate - 1 variable for the vehicle's model*/
        
        
GetPlayerPos(playeridxyz);
        
/* We stock the position in differents variables (x, y, z) */
        
GetPlayerFacingAngle(playeridAngle);
         
/* We stock the facing angle in the variable Angle*/
        
new vehicleid CreateVehicle(411xyzAngle, -1, -11000);
        
/* Replace 411 by the vehicle's model you want | -1 is a random color | Primary and secondary color
        CreateVehicle(modelOfTheVehicle, Coordinate x, Coordinate y, Coordinate z, rotation of the vehicle, Primary color (-1 is random), Secondary color (-1 is random), respawn delay (in ms));
        Link can be fin here : https://sampwiki.blast.hk/wiki/Vehicle_M...1.65917943
        We create the vehicle at the player's coordinate */
        
        
PutPlayerInVehicle(playeridvehicleid0);
        
/*We put the player in the vehicle at the seat 0. Why? Seat 0 = driver
        0 - Driver
        1 - Front passenger
        2 - Back-left passenger
        3 - Back-right passenger
        4+ - Passenger seats (coach etc.)*/
        
SendClientMessage(playeridCOLOR_GREEN"You have spawned an vehicle!"); // We send a basic message to say the player has been teleported
        
return 1;
    }
    return 
0;

I hope this new one is the good. Try to understand the script and not only C/C.

For +Rep someone, click on the star at the left bottom on a message.
Reply
#10

Good stuff. Well documented as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)