SA-MP Forums Archive
What can I do to improve this basic CMD? - 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: What can I do to improve this basic CMD? (/showthread.php?tid=401181)



What can I do to improve this basic CMD? - Jing_Chan - 22.12.2012

pawn Код:
if (strcmp("/taxihead", cmdtext, true, 10) == 0)
{
    new TaxiObject[MAX_VEHICLES];
    new VID = GetPlayerVehicleID(playerid);
    TaxiObject[VID] = CreateObject(19308, 50.0, 50.0, 30.0, 0, 0, 0);
    AttachObjectToVehicle(TaxiObject[VID], VID, -0.05, 0.0, 0.9, 0.0, 0.1, 0.0);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "* %s puts the taxi sign on the roof.", sendername);
    SendClientMessage(playerid, COLOR_GRAD2, "You have attached the sign to the roof.");
    return 1;
}
Fits a nice little taxi sign, however only fits on Premiers / Sultans.

So what could be done in order to improve this?


Re: What can I do to improve this basic CMD? - zDivine - 22.12.2012

The only thing I could thing of is to get the right coords for all the vehicles you wish to use, and then check if they are in that vehicle ID, and then set the object to the coord corresponding to that vehicle.


Re: What can I do to improve this basic CMD? - Jing_Chan - 22.12.2012

How do I make it so the command works only if your in a CERTAIN car?

pawn Код:
}
        if (strcmp("/taxihead", cmdtext, true, 10) == 0)
{
 if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] == 10
            {
            new TaxiObject[MAX_VEHICLES];
            new VID = GetPlayerVehicleID(playerid);
            TaxiObject[VID] = CreateObject(19308, 50.0, 50.0, 30.0, 0, 0, 0);
            [ I NEED TO PUT SOME CODE HERE TO RESTRICT TO A SULTAN ]
    {
            AttachObjectToVehicle(TaxiObject[VID], VID, -0.05, 0.0, 0.9, 0.0, 0.1, 0.0);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s puts the taxi sign on the roof.", sendername);
            SendClientMessage(playerid, COLOR_GRAD2, "You have attached the sign to the roof.");
    }
    else {
            SendClientMessage(playerid, COLOR_GRAD2, "You are not in a Sultan / part of the Taxi Cab Company!");
    }
    return 1;
}