Help With a dcmd Command
#3

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
Try this:
pawn Код:
// You might need this, if so, add it onto of your gamemode
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif

public OnPlayerCommandText(playerid, cmdtext[]) // Use ZCMD and save yourself from using this lines
{
    dcmd(vspawn, 6, cmdtext);
    return 0;
}

dcmd_vspawn(playerid, params[])
{
    if(!isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /VSpawn < Vehicle ID >"); // If the player didn't typed anything after /vspawn

    new
        i_Vehicle = strval(params),
        Float:v_Pos[4]; // We will get the player's pos and create the vehicle at that same spot.

    GetPlayerPos(playerid, v_Pos[0], v_Pos[1], v_Pos[2]); // Getting X, Y, Z and storing it in v_Pos
    GetPlayerFacingAngle(playerid, v_Pos[3]); // Getting the facing angle
   
    new
        iVehicle = CreateVehicle(i_Vehicle, v_Pos[0], v_Pos[1], v_Pos[2], v_Pos[3], -1, -1, (60*30)); // Create our vehicle

    PutPlayerInVehicle(playerid, iVehicle, 0); // Putting the player inside the vehicle as a driver
    return 1;
}
I'm sleepy, so I might of missed some code.

Cheers.
Thanks, I see what to do now. I've heard that dcmd is more simple so until I get at least a bit decent at scripting, I will switch to zcmd.
Reply


Messages In This Thread
Help With a dcmd Command - by gjsnoop - 23.05.2011, 03:51
Re: Help With a dcmd Command - by [L3th4l] - 23.05.2011, 04:20
Re: Help With a dcmd Command - by gjsnoop - 23.05.2011, 19:14
Re: Help With a dcmd Command - by gjsnoop - 23.05.2011, 19:38
Re: Help With a dcmd Command - by gjsnoop - 26.05.2011, 02:30

Forum Jump:


Users browsing this thread: 1 Guest(s)