SA-MP Forums Archive
how to make a 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: how to make a command? (/showthread.php?tid=522033)



how to make a command? - ReD_DeVi - 25.06.2014

how to make /v <name> color like that it can be used by players please help me


Re: how to make a command? - AdHaM612 - 25.06.2014

Can you describe your question more so we can help you ?
What do you mean by /v <name> ?


Re: how to make a command? - ReD_DeVi - 25.06.2014

this [Modelid/Name] [colour1] [colour2]


Re: how to make a command? - AdHaM612 - 25.06.2014

Do you mean a Vehicle Spawner ?


Re: how to make a command? - ReD_DeVi - 25.06.2014

yes without dialog box


Re : how to make a command? - Clad - 25.06.2014

pawn Код:
if(strcmp(cmd, "/veh", true, 10) == 0)
   
        {
        new String[200];
        new tmp[256];
        new Float:x, Float:y, Float:z;
       
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "You didn't give a vehicle name");

        new vehicle = GetVehicleModelIDFromName(tmp);

        if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, l_red, "That vehicle name was not found");

        new Float:a;
        GetPlayerFacingAngle(playerid, a);
        GetPlayerPos(playerid, x, y, z);

        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            GetXYInFrontOfPlayer(playerid, x, y, 8);
        }
        else
        {
            GetXYInFrontOfPlayer(playerid, x, y, 5);
        }
       
        new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
        LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));

        format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
        SendClientMessage(playerid, l_green, String);
        return 1;
    }



Re: how to make a command? - jueix - 25.06.2014

Код:
COMMAND:car(playerid, params[])
{
        new carid, carcolor1, carcolor2;
        if(!sscanf(params, "iii", carid, carcolor1, carcolor2))
        {
            if (carid == 432)
	    	return SendClientMessage(playerid, red, "Error: You Can not spawn a rhino / tank.");
	    	if (carid == 520)
	    	return SendClientMessage(playerid, red, "Error: You can not spawn a hydra.");
            if(carid >= 400 && carid <= 611)
            {
                if(carcolor1 >= 0 && carcolor1 <= 252)
                {
                    if(carcolor2 >= 0 && carcolor2 <= 252)
                    {
                        new Float:XZ, Float:YZ, Float:ZZ;
                        GetPlayerPos(playerid, XZ, YZ, ZZ);
                        SetVehicleVirtualWorld( CreateVehicle(carid, XZ+4, YZ, ZZ, 10, carcolor1, carcolor2, 0), GetPlayerVirtualWorld(playerid));
                        SendClientMessage(playerid, 0xD8D8D8FF, "Vehicle Spawned");
                        return 1;
                    }
                    else return SendClientMessage(playerid, 0xD8D8D8FF, "Only color id's between 0 and 252 are avaliable.");
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Only color id's between 0 and 252 are avaliable.");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "Only id's between 400 and 611 are avaliable.");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /car [VehicleId] [Color 1][Color 2]");
}



Re: how to make a command? - ReD_DeVi - 25.06.2014

i want in zcmd


Re : how to make a command? - Clad - 25.06.2014

Do you want Pizza too ? How about making some code by yourself ? You can't create your server in browsing the forum by such questions homie.


Re: how to make a command? - ReD_DeVi - 25.06.2014

okay just this help please

EDIT:I Got it Clad