Add teleport, and define a vehicle to give the player?
#1

Hello!

I am wondering if it is possible to make a teleport (in dcmd) where the player is teleported to the defined coordinates, and after teleporting, he gets a vehicle (i want the vehicle to be the Monster, id 444.). I want this because i am making a "monster derby". Is it possible?

Thanks!

And i am reachable on skype: a380sas (write in the request that you are going to help with the teleport cmd)

Airplanesimen
Reply
#2

Of course...

This vehicle will be created at once, or has been previously created?

pawn Код:
new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
PutPlayerInVehicle(playerid, VehicleID, 0);
//LinkVehicleToInterior(VehicleID, NUMBER); // if interior > 0
//SetPlayerInterior(VehicleID, NUMBER); // if interior > 0
Reply
#3

use PutPlayerInVehicle
Reply
#4

Add this anywhere in ur script:
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SetPlayerPos(playerid, x, y, z);              //here ur co-ordiantes
    return 1;
}
and add this below OnPlayerCommandText:
pawn Код:
dcmd(monsterderby1, 13, cmdtext[])
Reply
#5

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SetPlayerPos(playerid, x, y, z);              //here ur co-ordiantes
    return 1;
}
You can't use SetPlayerPos in this case, because the player will leave the car
Reply
#6

Right!

Thanks guys, really helped me ^^ So-- Solved
Reply
#7

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Add this anywhere in ur script:
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SetPlayerPos(playerid, x, y, z);              //here ur co-ordiantes
    return 1;
}
and add this below OnPlayerCommandText:
pawn Код:
dcmd(monsterderby1, 13, cmdtext[])
That line i have to put under OnPlayerCommandText, what is the second argument for, the number? I have always wondered about that ^^
Reply
#8

it's just the lenght of the command.
And also to make the command use less space use this.
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    PutPlayerInVehicle(playerid,(CreateVehicle(444,X,Y,Z,A,-1,-1,-1)), 0);
    SetPlayerPos(playerid, x, y, z);            
    return 1;
}
Reply
#9

You cant use SetPlayerPos after putting player in a car. The player will be teleported, and not be in a car ^^ And you sure that 13 is for the lenght?
Reply
#10

I know that about the SetPlayerPos i did not see it actually just scripted something to make the code easyer.
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    PutPlayerInVehicle(playerid,(CreateVehicle(444,X,Y,Z,A,-1,-1,-1)), 0);            
    return 1;
}
also i do not see any other alternative then the lenght. The same shit is in strcmp
pawn Код:
if(strcmp("/command",cmdtext,true,10) == 0)
//or the easy version of strcmp
if(strcmp("/command",cmdtext,true) == 0)
it happens that if you change the number that is 10 in this on to the lenght of the command or more. This is mostly used if the command is in two words.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)