Car Spawn
#1

How do i make a command that spawns a certain car model next to you. Like i say /buffalo and an buffalo spawns next to me?
Reply
#2

pawn Код:
COMMAND:mower ( playerid, params [ ] )
{
    new
        Float: X,
        Float: Y,
        Float: Z,
        Float: A;
 
    GetPlayerPos ( playerid, X, Y, Z );
    GetPlayerFacingAngle ( playerid, A );

    CreateVehicle ( 572, X + 4.0, Y, Z, A, -1, -1, -1 )  
    return 1;
}
You can always use a stock too.

EDIT :
Here's an example of a stock.

pawn Код:
stock CreateVehForPlayer(playerid, vehid)
{
    // Copy from the example above
   new
        Float: X,
        Float: Y,
        Float: Z,
        Float: A;
 
    GetPlayerPos ( playerid, X, Y, Z );
    GetPlayerFacingAngle ( playerid, A );
    //

    CreateVehicle ( vehid, X + 4.0, Y, Z, A, -1, -1, -1 ) ;
    return 1;
}

e.G : CreateVehForPlayer(playerid, 411);
Reply
#3

Quote:
Originally Posted by Basicz
Посмотреть сообщение
pawn Код:
COMMAND:mower ( playerid, params [ ] )
{
    new
        Float: X,
        Float: Y,
        Float: Z,
        Float: A;
 
    GetPlayerPos ( playerid, X, Y, Z );
    GetPlayerFacingAngle ( playerid, A );

    CreateVehicle ( 572, X + 4.0, Y, Z, A, -1, -1, -1 )  
    return 1;
}
You can always use a stock too.
and spam upto 2000 lines with every every car?
Reply
#4

Quote:
Originally Posted by admantis
Посмотреть сообщение
and spam upto 2000 lines with every every car?
Uhmm.. What do you mean? I am a little bit confused...
Reply
#5

Quote:
Originally Posted by Basicz
Посмотреть сообщение
Uhmm.. What do you mean? I am a little bit confused...
i mean he has to do /mower but he has to make more commands for every single car so it's better using strtok or sscanf
Reply
#6

Oh yeah, that will be bad.

This is Rokzlive's message : "Like i say /buffalo and an buffalo spawns next to me?"

But like what admantis said, it's better to do /spawncar [vehid] command.
Reply
#7

I did this:
pawn Код:
if(!strcmp(cmdtext, "/mower", true))
    {
        new
            Float: X,
            Float: Y,
            Float: Z,
            Float: A,
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        CreateVehicle(572, X +4.0, Y, Z, -1, -1, -1);
        return 1;
    }

And got these errors.
Код:
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : warning 219: local variable "GetPlayerPos" shadows a variable at a preceding level
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : error 001: expected token: ";", but found "("
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : warning 215: expression has no effect
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(837) : warning 202: number of arguments does not match definition
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : warning 203: symbol is never used: "GetPlayerPos"
Reply
#8

Change
Float: A,

TO
Float: A;

EDIT:
And the CreateVehicle
TO
CreateVehicle ( 572, X + 4.0, Y, Z, A, -1, -1, -1 );
Reply
#9

I want to make individual commands, i just like it that way instead of remembering ids, so what i do?
Reply
#10

Nevermind that fixed it, thankyou.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)