Please help me - 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: Please help me (
/showthread.php?tid=557939)
Please help me[+REP] -
salev13 - 15.01.2015
When i doing the command but using Slot 6
thats told me unknown command
and as you can see slots are between 1 ~ 25
PHP код:
else if(!strcmp(option, "vehicle", true, 7))
{
if(sscanf(params, "is[32]iiii", idx, option, veh, vehid, col1, col2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fedit [familyslot] vehicle [vehicleslot] [vehiclemodel] [color1] [color2]");
if(veh < 1 || veh > 25) return SendClientMessage(playerid, COLOR_GREY, "Vehicle slots are between 1 and 25.");
veh = veh-1;
if(FamInfo[idx][fVehType][veh])
{
FamInfo[idx][fVehType][veh] = 0;
FamInfo[idx][fVehCoX][veh] = 0;
FamInfo[idx][fVehCoY][veh] = 0;
FamInfo[idx][fVehCoZ][veh] = 0;
FamInfo[idx][fVehRot][veh] = 0;
FamInfo[idx][fVehCol1][veh] = 0;
FamInfo[idx][fVehCol2][veh] = 0;
DestroyVehicle(FamInfo[idx][fVeh][veh]);
}
if(vehid)
{
FamInfo[idx][fVehType][veh] = vehid;
GetPlayerPos(playerid, FamInfo[idx][fVehCoX][veh], FamInfo[idx][fVehCoY][veh], FamInfo[idx][fVehCoZ][veh]);
GetPlayerFacingAngle(playerid, FamInfo[idx][fVehRot][veh]);
FamInfo[idx][fVehCol1][veh] = col1;
FamInfo[idx][fVehCol2][veh] = col2;
FamInfo[idx][fVeh][veh] = CreateVehicle(vehid, FamInfo[idx][fVehCoX][veh], FamInfo[idx][fVehCoY][veh], FamInfo[idx][fVehCoZ][veh], FamInfo[idx][fVehRot][veh], FamInfo[idx][fVehCol1][veh], FamInfo[idx][fVehCol2][veh], 12000);
ChangeVehicleColor(FamInfo[idx][fVeh][veh], FamInfo[idx][fVehCol1][veh], FamInfo[idx][fVehCol2][veh]);
Fam[FamInfo[idx][fVeh][veh]] = idx;
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set family %d's vehicle slot %d to ID %d.", NORPN(playerid), idx, veh+1, vehid);
SendAdminMessage(COLOR_DARKRED, 1, string);
}
}
else SendClientMessage(playerid, COLOR_GREY, "Invalid option.");
return 1;
}
Re: Please help me -
HazardouS - 15.01.2015
If the vehicle name contains a space character (" "), sscanf will take the second word in the name as the next parameter. For example:
pawn Код:
/fedit 1 NRG-500 2 522 3 1
//idx = 1, option = "NRG-500", veh = 2, vehid = 522, col1 = 3, col2 = 1
/fedit 1 Land Stalker 2 400 3 1
//idx = 1, option = "Land", veh = "Stalker", vehid = 2, col1 = 400, col2 = 3, that last parameter is useless
In the second example, veh is an integer, so it can't store a string. This can very easily generate an Unknow command error.
I didn't check the rest of the code, maybe someone else will find any errors there.
Re: Please help me -
salev13 - 15.01.2015
Okay i will wait for more answers
ty anyway