/veh 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: /veh command (
/showthread.php?tid=499968)
/veh command -
CallumDaBest - 10.03.2014
I was wondering how do i create the /veh command i have tried so many times but instead made Messages such as Syntax: /veh [MODELID] and then done /veh 451[turismo] and it has said your car has been spawned but has not so could anyone create the command i am seeking please(NONMYSQL)
AW: /veh command -
Macronix - 10.03.2014
Do you already have a /veh command? If so, show me, i try to fix it.
Re: /veh command -
Lidor124 - 10.03.2014
Show us your codes ?
Re: /veh command -
CallumDaBest - 10.03.2014
I deleted them as i said could you create one please?
Re: /veh command -
Lidor124 - 10.03.2014
Quote:
Originally Posted by CallumDaBest
I deleted them as i said could you create one please?
|
I copied that code from my gamemode, working 100%
Код:
CMD:veh(playerid, params[]) {
if (PlayerInfo[playerid][pAdmin] >= 2) {
new
iVehicle,
iColors[2];
if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
}
else if(!(400 <= iVehicle <= 611)) {
SendClientMessage(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
}
else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
SendClientMessage(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
}
else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {
new
Float: fVehPos[4];
GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
GetPlayerFacingAngle(playerid, fVehPos[3]);
CreatedCars[iIterator] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
VehicleFuel[CreatedCars[iIterator]] = 100.0;
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(CreatedCars[iIterator], GetVehicleVirtualWorld(CreatedCars[iIterator]));
return SendClientMessage(playerid, COLOR_GREY, "Vehicle spawned!");
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
Re : /veh command -
Clad - 10.03.2014
You needs command for spawning vehicles ?
AW: /veh command -
Macronix - 10.03.2014
pawn Код:
if(!strcmp(cmd, "/veh", true))
{
new carmodel[256];
carmodel = strtok(cmdtext, idx);
if(!strlen(carmodel)) return SendClientMessage(playerid, -1, "[USAGE]: /veh [modelid]");
new carmodelid = strval(carmodel);
if(carmodelid < 400 || carmodelid > 611) return SendClientMessage(playerid, -1, "[ERROR]: Invalid model id!");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
CreateVehicle(carmodelid, X, Y+2, Z+1, A, -1, -1, 300);
new string[256];
format(string, 256, "[SUCESS]: Spawned vehicle id %d", carmodelid);
SendClientMessage(playerid, -1, string);
return 1;
}