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 |
#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(playerid, cmdtext[])
{
if (strcmp("/tp", cmdtext, true) == 0) // If the player type /tp than we executes thos following lines
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_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(vehicleid, x, y, z);
/*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(playerid, vehicleid, 0);
/*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(playerid, COLOR_GREEN, "You have been teleported!"); // We send a basic message to say the player has been teleported
return 1;
}
return 0;
}
SendClientMessage(playerid, COLOR_GREEN, "Your VIP vehicle has arrived!");
yea, that first \ really looked odd to me simply being out of the string.
|
#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(playerid, cmdtext[])
{
if (strcmp("/tp", cmdtext, true) == 0) // If the player type /tp than we executes thos following lines
{
CreateVehicle(411, 1, 1, 1, 1, -1, -1, 10000);
/* 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(vehicleid, x, y, z);
/*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(playerid, vehicleid, 0);
/*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(playerid, COLOR_GREEN, "You have been teleported!"); // We send a basic message to say the player has been teleported
return 1;
}
return 0;
}
#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(playerid, params[])
{
new model;
if(sscanf(params, "i", model) return SendClientMessage(playerid, COLOR_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(playerid, COLOR_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(model, 1, 1, 1, 1, -1, -1, 10000);
/* 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(vehicleid, x, y, z);
/*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(playerid, vehicleid, 0);
/*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(playerid, COLOR_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
}
Alright, that's not the same thing. You want script something. I will try to help you then.
PHP код:
|
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 |
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/tp", true) == 0) // If the player type /tp than we executes thos following lines
{
new Float:x, Float:y, Float:z, Float:Angle;
/* 4 variables : x, y, z, angle for create the vehicle at player's coordinate - 1 variable for the vehicle's model*/
GetPlayerPos(playerid, x, y, z);
/* We stock the position in differents variables (x, y, z) */
GetPlayerFacingAngle(playerid, Angle);
/* We stock the facing angle in the variable Angle*/
new vehicleid = CreateVehicle(411, x, y, z, Angle, -1, -1, 1000);
/* 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_Model_ID_List
We create the vehicle at the player's coordinate */
PutPlayerInVehicle(playerid, vehicleid, 0);
/*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(playerid, COLOR_GREEN, "You have spawned an vehicle!"); // We send a basic message to say the player has been teleported
return 1;
}
return 0;
}