/veh is letting other people use it. - 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 is letting other people use it. (
/showthread.php?tid=377759)
/veh is letting other people use it. -
MagicClucker - 15.09.2012
PHP Code:
CMD:car(playerid, params[]) {
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Administrator Command Duty to use this Command!");
if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pUndercover] >=1) {
new
iVehicle,
iColors[2];
if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [model ID] [color 1] [color 2]");
}
else if(!(400 <= iVehicle <= 611)) {
SendClientMessageEx(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)) {
SendClientMessageEx(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));
return SendClientMessageEx(playerid, COLOR_GREY, "Car spawned!");
}
}
else SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Command is not in your authority to be used!");
return 1;
}
When Im ingame players also can use the /car Command how do I fix it?
Re: /veh is letting other people use it. -
Sig Hansen - 15.09.2012
This Should Fix It;
PHP Code:
CMD:car(playerid, params[]) {
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
if (PlayerInfo[playerid][pAdmin] >= 4) {
new
iVehicle,
iColors[2];
if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
}
else if(!(400 <= iVehicle <= 611)) {
SendClientMessageEx(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)) {
SendClientMessageEx(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));
return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
Re: /veh is letting other people use it. -
gtakillerIV - 15.09.2012
Argh sorry again didin't real the whole thing