Does this need a return? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Does this need a return? (
/showthread.php?tid=270515)
Does this need a return? -
Shockey HD - 20.07.2011
Код:
public FixAllCar()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerVipType(playerid,3))
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);// gettin the vehicle id
SetVehicleHealth(vehicleid,1000.0);// set the vehicle healt
}
}
}
If so return 1; or return 0;?
Because im getting this error
Код:
C:\Documents and Settings\Chris\My Documents\My Received Files\FreeRoam(3).pwn(3318) : error 030: compound statement not closed at the end of file (started at line 3307)
Re: Does this need a return? -
Grim_ - 20.07.2011
Not unless you return it in another function.
The reason for the error is that you are missing a bracket at the end of the function:
pawn Код:
public FixAllCar()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerVipType(playerid,3))
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);// gettin the vehicle id
SetVehicleHealth(vehicleid,1000.0);// set the vehicle healt
}
}
}
}
Re: Does this need a return? -
DRIFT_HUNTER - 20.07.2011
pawn Код:
public FixAllCar()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerVipType(playerid,3))
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);// gettin the vehicle id
SetVehicleHealth(vehicleid,1000.0);// set the vehicle healt
}
}
}
return 1;//You dont need it but you can use it
}
You forgot one } and you dont need return but you can use it
[EDIT]I late
Re: Does this need a return? -
Shockey HD - 20.07.2011
Thanks Guys :] Really big help xD