PDA

View Full Version : Exit sub if the statement is true.


Inon
04-11-2009, 04:10 PM
Hello.

I have this code for example:


if isPlayerInAnyVehicle ( PlayerID ) == true then --statement
gameTextForPlayer(PlayerID, "Dont call and drive!", 2, 200)
end


but "end" doesn't close the hole function. And I need to hole function closed if the statetemt is true.


Please help?

Mex
04-11-2009, 04:18 PM
if isPlayerInAnyVehicle ( PlayerID ) == true then
gameTextForPlayer(PlayerID, "Dont call and drive!", 2, 200)
return
end

return will stop the rest of the code being executed inside the function.

Inon
04-12-2009, 04:43 AM
Thank you! The scirpting langauge of VCO lookes like VB.net, it's very easy!