Too much error. - 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: Too much error. (
/showthread.php?tid=426434)
Too much error. -
LeeXian99 - 29.03.2013
While I am scripting /v, I got a lot of errors in this script.
pawn Код:
CMD:v(playerid,params[])
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
new tmp3[256]; tmp3 = strtok(params,Index);
if(!strlen(tmp)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /car [ModelID/Name] [Colour1] [Colour2]") &&
SendClientMessage(playerid, orange, "Function: Will create a Car with specified Colours");
new car;
new string[128];
new colour1, colour2;
if(!IsNumeric(tmp))
car = GetVehicleModelIDFromName(tmp);
else car = strval(tmp);
if(car < 400 || car > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model ID!");
if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
if(!IsPlayerAdmin(playerid))
EraseVeh(AccInfo[playerid][pCar]);
new LVehicleID;
new Float:X,Float:Y,Float:Z;
new Float:Angle,int1;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
int1 = GetPlayerInterior(playerid);
LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
LinkVehicleToInterior(LVehicleID,int1);
AccInfo[playerid][pCar] = LVehicleID;
format(string, sizeof(string), "%s Spawned a \"%s\" (Model:%d) Colours (%d, %d), Pos: X:%0.2f, Y:%0.2f, Z:%0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
SaveIn("CarSpawns",string);
format(string, sizeof(string), "|- You have Spawned a \"%s\" (Model: %d) with Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
return SendClientMessage(playerid,LIGHTBLUE, string);
}
Errors:
Код:
C:\Users\Kelvin\Desktop\Scripting\pawno\include\dutils.inc(28) : error 021: symbol already defined: "isNumeric"
C:\Users\Kelvin\Desktop\Scripting\pawno\include\dutils.inc(379) : error 025: function heading differs from prototype
C:\Users\Kelvin\Desktop\Scripting\pawno\include\dutils.inc(380) : error 021: symbol already defined: "strtok"
C:\Users\Kelvin\Desktop\Scripting\pawno\include\dutils.inc(395) : error 047: array sizes do not match, or destination array is too small
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6534) : error 017: undefined symbol "IsNumeric"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6535) : error 017: undefined symbol "GetVehicleModelIDFromName"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6542) : error 017: undefined symbol "EraseVeh"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6542) : warning 215: expression has no effect
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6542) : error 001: expected token: ";", but found "]"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6542) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(6542) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
10 Errors.
Re: Too much error. -
Nivniv2 - 29.03.2013
Try to use this:
Код:
CMD:v(playerid, params[]) {
new
iVehicle,
iColors[2];
if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /v [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_LIGHTBLUE, "Vehicle spawned!");
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
Re: Too much error. -
LeeXian99 - 29.03.2013
I want it for global.. Not for admins...
Re: Too much error. -
Black Wolf - 29.03.2013
Ok first of all
search for stock isNumeric in your script and remove it same with stock strtok as you have defined both of them 2 times.and then use that command posted above your reply.Its not for admins.
Re: Too much error. -
LeeXian99 - 29.03.2013
nvm, I will leave it for a while. I will use LuxAdmin's car system first. c: