Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp // we include samp functions and defines to our scripts to be able to use them
- /*
- a_samp includes the callbacks for us so we don't need to annoy our selfs defining them manually example:
- forward OnPlayerConnect(playerid), which defines OnPlayerConnect callback it's defined in a_samp include so we don't need to write it by ourself!
- */
- public OnPlayerConnect(playerid) // publics are callbacks which can be called by samp by default or we can call them by our selfs OnPlayerConnect being called when player connects to our server
- { // will tell the script we got more than one function to do under this callback
- CallLocalFunction(
- /*Our Functions / callback name*/"OnPlayerConnectEx",/* we can use d,i or u to handle player id in them! example I will use i because it's thing*/ "i",/*here we put the playerid which will be the id of player which joined our server*/playerid); // < close our CallLocalFunction FUnction.
- // ^ we can make our own OnPlayerConnectEx which will be called at the same time when OnPlayerConnect be called! for that we use CallLocalFunction
- return 1; // return the value which will be called if player connected successfully!
- } // will tell the scripts we finished from this callback
- // Here we will define our OnPlayerConnectEx callback manually!
- // forward mean our function will be able to call it by CallLocalFunction or CallRemoteFUnctio functions!
- // public means our callback it's public which it's return vale will be number 0..9999
- // and last we write callback name then we open it by ( and write what data we will give this callback, we will give it playerid
- forward public OnPlayerConnectEx(playerid); // we have successfully deinfed our callback!
- public OnPlayerConnectEx(playerid)
- {// tells our callback we got more than 1 functions under you
- SendClientMessage(playerid, /* color which will be -1 = white*/ -1, /* our message */"OnPlayerConnectEx Cough ya bish!");// we will tell the player that our OnPlayerConnectEx cough him!
- return 1; // returns a value
- } // closes our functions
Advertisement
Add Comment
Please, Sign In to add comment