06.01.2010, 13:15
the reason it didnt work is you close the beginning of the if statement then tried to make it work from the middle of the if statement.
you cant start an if statement from an else
ie
if(){
if(){
if(){
}
}
}
each if has to be opened and closed
if i was to take away one of those ifs without sorting the other end of it, it will throw up an exception
example
if(){
//if(){
if(){
}
}
}
there are still 3 closes but only 2 opens
which means that the script is trying to close something that isnt there (or maybe the entire function) before its sposed to.
note that all public functions work the same way:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
}
so you might be removing something in the middle but accidentally ending the public function too early and leaving script that isnt related to anything outside a function.
this is what throws up exceptions. as you are new to coding having an explanation is handy.
you cant start an if statement from an else
ie
if(){
if(){
if(){
}
}
}
each if has to be opened and closed
if i was to take away one of those ifs without sorting the other end of it, it will throw up an exception
example
if(){
//if(){
if(){
}
}
}
there are still 3 closes but only 2 opens
which means that the script is trying to close something that isnt there (or maybe the entire function) before its sposed to.
note that all public functions work the same way:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
}
so you might be removing something in the middle but accidentally ending the public function too early and leaving script that isnt related to anything outside a function.
this is what throws up exceptions. as you are new to coding having an explanation is handy.