SA-MP Forums Archive
[Question] /car command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Question] /car command (/showthread.php?tid=364109)



[Question] /car command - mickos - 29.07.2012

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


Re: [Question] /car command - mickos - 29.07.2012

Anyone that can help me?


Re: [Question] /car command - Misiur - 29.07.2012

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;
}



Re: [Question] /car command - TaLhA XIV - 29.07.2012

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


Re: [Question] /car command - mickos - 29.07.2012

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


Re: [Question] /car command - SEnergy - 29.07.2012

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


Re: [Question] /car command - mickos - 29.07.2012

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

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


Re: [Question] /car command - SEnergy - 29.07.2012

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


Re: [Question] /car command - mickos - 29.07.2012

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


Re: [Question] /car command - SEnergy - 29.07.2012

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


Re: [Question] /car command - mickos - 29.07.2012

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?


Re: [Question] /car command - mickos - 30.07.2012

Anyone that know it? ty


Re: [Question] /car command - SEnergy - 30.07.2012

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


Re: [Question] /car command - mickos - 30.07.2012

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..


Re: [Question] /car command - cosbraa - 30.07.2012

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


Re: [Question] /car command - mickos - 30.07.2012

REMOVED


Re: [Question] /car command - maaz - 04.04.2014

thanks for that script it worked for me