jlalt

lesson 1

Jun 12th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.04 KB | None | 0 0
  1. #include a_samp // we include samp functions and defines to our scripts to be able to use them
  2.  
  3. /*
  4. a_samp includes the callbacks for us so we don't need to annoy our selfs defining them manually example:
  5.  
  6. forward OnPlayerConnect(playerid), which defines OnPlayerConnect callback it's defined in a_samp include so we don't need to write it by ourself!
  7. */
  8.  
  9. 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
  10. { // will tell the script we got more than one function to do under this callback
  11.     CallLocalFunction(
  12.     /*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.
  13.     // ^ we can make our own OnPlayerConnectEx which will be called at the same time when OnPlayerConnect be called! for that we use CallLocalFunction
  14.    
  15.     return 1; // return the value which will be called if player connected successfully!
  16. } // will tell the scripts we finished from this callback
  17.  
  18.  
  19. // Here we will define our OnPlayerConnectEx callback manually!
  20.  
  21. // forward mean our function will be able to call it by CallLocalFunction or CallRemoteFUnctio functions!
  22. // public means our callback it's public which it's return vale will be number 0..9999
  23. // 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
  24. forward public OnPlayerConnectEx(playerid); // we have successfully deinfed our callback!
  25.  
  26. public OnPlayerConnectEx(playerid)
  27. {// tells our callback we got more than 1 functions under you
  28.    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!
  29.    return 1; // returns a value
  30. } // closes our functions
Advertisement
Add Comment
Please, Sign In to add comment