[Question] /car command
#1

Hey there,

I got a question namely:
How can I make a command just likes this: /car
And when a player do that he will be spawn an infernus and will be automatically in the infernus.

Anyone how I can make that?

Thanks!

Mickos0087
Reply
#2

Anyone that can help me?
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/car", true)) {
        new Float:up[3], carid;
        GetPlayerPos(playerid, up[0], up[1], up[2]);
        carid = CreateVehicle(411, up[0]+2, up[1]+2, up[2], 0, -1, -1, 0);
        PutPlayerInVehicle(playerid, carid, 0);
        SendClientMessage(playerid, -1, "Here's your car");
        return 1;
    }
    return 0;
}
Reply
#4

First do AddStaticVehicle(check this on wiki if you don't know how to use this).Then do PutPlayerInVehicle(the same thing)
Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/car", true)) {
        new Float:up[3], carid;
        GetPlayerPos(playerid, up[0], up[1], up[2]);
        carid = CreateVehicle(411, up[0]+2, up[1]+2, up[2], 0, -1, -1, 0);
        PutPlayerInVehicle(playerid, carid, 0);
        SendClientMessage(playerid, -1, "Here's your car");
        return 1;
    }
    return 0;
}
Hey thanks bro it works!

But one last question:

When I am in a interior and I do /car
I didnt see my car but I am in the vehicle, how can I fix that?

And this:

When a player do /car and he will be leave his car, and later he do again /car, that the first car he was spawning will be gone, how can I script that?


Thanks
Reply
#6

Quote:
Originally Posted by mickos0087
Посмотреть сообщение
Hey thanks bro it works!

But one last question:

When I am in a interior and I do /car
I didnt see my car but I am in the vehicle, how can I fix that?

And this:

When a player do /car and he will be leave his car, and later he do again /car, that the first car he was spawning will be gone, how can I script that?


Thanks
interior thing - do a check if a player is in interior, if no then spawn a car

only one car thing - create variable that will hold vehicleid of spawned vehicle and after using command again it will check and destroy spawned vehicle
Reply
#7

Ah,, for the interior I must be do GetPlayerInterior ?

And how do I create a variable for the one car thing?
Reply
#8

Quote:
Originally Posted by mickos0087
Посмотреть сообщение
Ah,, for the interior I must be do GetPlayerInterior ?

And how do I create a variable for the one car thing?
1. yes
2. just like any other variable
Reply
#9

Thanks man but.I dont know a variable for one car thing
Reply
#10

Quote:
Originally Posted by mickos0087
Посмотреть сообщение
Thanks man but.I dont know a variable for one car thing
actually, this is the best reason and time to go and read something on wiki/forum and learn something new
Reply
#11

It didnt work I have:

PHP код:
if(!strcmp(cmdtext"/car"true))
        {
        new 
string[128];
        
format(stringsizeof(string), "Interior: %i",GetPlayerInterior(playerid));
        new 
Float:up[3], carid;
          
GetPlayerPos(playeridup[0], up[1], up[2]);
        
carid CreateVehicle(411up[0]+2up[1]+2up[2], 0, -1, -10);
        
PutPlayerInVehicle(playeridcarid0);
        return 
1;
        } 
But the interior thing didnt work?
whats wrong?
Reply
#12

Anyone that know it? ty
Reply
#13

Quote:
Originally Posted by mickos0087
Посмотреть сообщение
Anyone that know it? ty
are you kidding me? I already told you how to do that, try to look up for some functions at wiki, nobody's gonna do it for you for free, this is not how life works, you can't raly on other ppl all the time, they won't do everything for you, you have to do most things on your own, this section is not to post your idea and wait for whole code, this section is for collecting suggestions on how to do that and do it on your own, now get your fuckin ass up and work on that instead of bumping this topic that was already answered by me
Reply
#14

Quote:
Originally Posted by SEnergy
Посмотреть сообщение
are you kidding me? I already told you how to do that, try to look up for some functions at wiki, nobody's gonna do it for you for free, this is not how life works, you can't raly on other ppl all the time, they won't do everything for you, you have to do most things on your own, this section is not to post your idea and wait for whole code, this section is for collecting suggestions on how to do that and do it on your own, now get your fuckin ass up and work on that instead of bumping this topic that was already answered by me
Yes and I dont know why the GetPlayerInterior didnt work and was i asking for a code? NP! I was ask if anyone can help me..
Reply
#15

Add these 2 lines in your /car command.
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
Reply
#16

REMOVED
Reply
#17

thanks for that script it worked for me
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)