SA-MP Forums Archive
Please help me!? - 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: Please help me!? (/showthread.php?tid=185273)



Please help me!? - BigAl - 24.10.2010

Hello, i was wondering how i could join 2 different scripts together.

For example:

OnPlayerStateChange(blahdy blahdy blah)
{



Nos script


Private vehicle script

return 1;
}

Please help me, its desperately needed.


Re: Please help me!? - LarzI - 24.10.2010

Here's how

pawn Код:
// NOS script
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    stuff_from_nos_script;
    return 1;
}

//       +

//private vehicle script
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    stuff_from_prv_veh_script;
    return 1;
}
Equals:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    stuff_from_nos_script;
    stuff_from_prv_veh_script;
    return 1;
}
Voilа


Re: Please help me!? - BigAl - 24.10.2010

sorry mate but u cant put two of the same thing in a script, u cant put OnPlayerStateChange twice?


Re: Please help me!? - BigAl - 24.10.2010

error 021: symbol already defined: "OnPlayerStateChange"


Re: Please help me!? - LarzI - 24.10.2010

You can't put OnPlayerStateChange twice, no.
You merge it's contents together.


Re: Please help me!? - BigAl - 24.10.2010

can u give me an example please?


Re: Please help me!? - LarzI - 24.10.2010

I just did.


Re: Please help me!? - BigAl - 24.10.2010

not a clear example


Re: Please help me!? - LarzI - 24.10.2010

Both scripts contains stuff inside OnPlayerStateChange (example)
And if you want both in same script, you just easily put the contents of BOTH scripts into the OnPlayerStateChange callback in the script you want both in.


Re: Please help me!? - BigAl - 24.10.2010

yeh but how, it is not working for ME!?