SA-MP Forums Archive
What is wrong in this? - 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: What is wrong in this? (/showthread.php?tid=432087)



What is wrong in this? - lexurs - 21.04.2013

I am trying to make a command so that a Bulldozer can be placed on a Flatbed.. I do this,

if(arr_Wrecking[i] == vehicleid)
{
for(new i=0; i<sizeof(arr_Wrecking); i++)
{
arr_Wrecking[i] = INVALID_VEHICLE_ID;
playerveh[i] = INVALID_VEHICLE_ID;
KillTimer(TimerAtach[i]);
DestroyObject(GetPVarInt(i, "WreckingGate"));
DeletePVar(i, "WreckingGate");
return 1;
}

..But then I start getting errors about "SendClientMessageEx", and it all started happening when I added this line in,
for(new i=0; i<sizeof(arr_Wrecking); i++) .. Without that line though, I start getting errors, "undefined symbol "i" many times. I am a very nooby scripter so please help ..


Re: What is wrong in this? - mrtms - 21.04.2013

Well first you're getting undefined i because you're not defining the what the variable "i" is. You need to do this at the top of the command or whatever it is that you're using. This here also is a problem, since you said you didn't define "i" then how does the script know what the "i" variable is being assigned to:

if(arr_Wrecking[i] == vehicleid)
{

That needs to be replaced or fixed with whatever you're doing with that. I suggest you post the entire code of what you're trying to do so we have a better understanding of what you're trying to accomplish and where your errors are.


Re: What is wrong in this? - lexurs - 21.04.2013

I put that under public OnVehicleDeath(vehicleid)


Re: What is wrong in this? - lexurs - 21.04.2013

Here is the entire part..


public OnVehicleDeath(vehicleid)
{
if(Lamp[vehicleid] == 1)
{
DestroyObject(light[vehicleid]);
Lamp[vehicleid] = 0;
}
VehicleStatus{vehicleid} = 1;
arr_Engine{vehicleid} = 0;
estacionveh[vehicleid] = 0;
return 1;
{

if(arr_Wrecking[i] == vehicleid)
{
for(new i=0; i<sizeof(arr_Wrecking); i++)
{
arr_Wrecking[i] = INVALID_VEHICLE_ID;
playerveh[i] = INVALID_VEHICLE_ID;
KillTimer(TimerATACH[i]);
DestroyObject(GetPVarInt(i, "WreckingGate"));
DeletePVar(i, "WreckingGate");
return 1;
}
}