Guest User

Oxside

a guest
Dec 16th, 2009
1,799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.22 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dudb>
  3. #include <color>
  4.  
  5. main(){print("GameMode Loaded");}
  6.  
  7. new Faction[MAX_PLAYERS];
  8.                                                                                                                                                                     /*
  9. With new we create a new variable.
  10. We can store numbers in a variable.
  11. So if Faction = 0 then the player didn't join one
  12. if Faction = 1 then a player joined LSPD(Example) and if
  13. Faction = 2 then player joined Taxi Drivers(Example)
  14. So you can make as many factions you want.
  15. Just make a list:
  16. Nothing = 0
  17. LSPD = 1
  18. Taxi Driver = 2
  19. Car Jacker = 3
  20. Civilian = 4
  21.                                                                                                                                                
  22. To check if the player is in a faction you add the following lines:
  23. if(Faction[playerid] == 0) // 0 is a example you can replace it with any number (0 = No Faction)
  24. {
  25.     // Here what must hapen with the player is the faction = the id you typed
  26. }
  27. else
  28. {
  29.     // Here what must hapen with the player if he is not the faction
  30. }                                                                                                                                                                                       */
  31.  
  32. public OnGameModeInit()
  33. {
  34.     SetGameModeText("Blank Script");
  35.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  36.     return 1;
  37. }
  38.  
  39. public OnGameModeExit()
  40. {
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerRequestClass(playerid, classid)
  45. {
  46.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  47.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  48.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  49.     return 1;
  50. }
  51.  
  52. // Saving the id of the faction on player connect
  53. public OnPlayerConnect(playerid)
  54. {
  55.     new formatZ[256];
  56.     new pName[MAX_PLAYER_NAME];
  57.     new string[48];
  58.     format(formatZ,sizeof(formatZ),"%s.txt",PlayerName(playerid));
  59.     if(!udb_Exists(formatZ))
  60.     {
  61.     udb_Create(formatZ,"209010");
  62.     }
  63.     Faction[playerid] = dUserINT(formatZ).("Faction");
  64.     return 1;
  65. }
  66.  
  67. // Saving the id of the faction on player disconnect
  68. public OnPlayerDisconnect(playerid, reason)
  69. {
  70.     new formatZ2[256];
  71.     new pName[MAX_PLAYER_NAME];
  72.     new string[56];
  73.     format(formatZ2,sizeof(formatZ2),"%s.txt",PlayerName(playerid));
  74.     dUserSetINT(formatZ2).("Faction",Faction[playerid]);
  75.     return 1;
  76. }
  77. stock PlayerName(playerid) {
  78.   new name[255];
  79.   GetPlayerName(playerid, name, 255);
  80.   return name;
  81. }
  82.  
  83. public OnPlayerSpawn(playerid)
  84. {
  85.     return 1;
  86. }
  87.  
  88. public OnPlayerDeath(playerid, killerid, reason)
  89. {
  90.     return 1;
  91. }
  92.  
  93. public OnVehicleSpawn(vehicleid)
  94. {
  95.     return 1;
  96. }
  97.  
  98. public OnVehicleDeath(vehicleid, killerid)
  99. {
  100.     return 1;
  101. }
  102.  
  103. public OnPlayerText(playerid, text[])
  104. {
  105.     return 1;
  106. }
  107.  
  108. public OnPlayerCommandText(playerid, cmdtext[])
  109. {
  110.     if (strcmp("/joinfaction", cmdtext, true, 10) == 0)
  111.     {
  112.         // Copy this command as much as you want and edit it to create multiple join faction command
  113.         SendClientMessage(playerid, COLOR_RED, "* You joined faction 1");
  114.         Faction[playerid] = 1; // << With this we set Faction ID to 1, change 1 to any Faction ID                                                                                                                                                                               */
  115.         return 1;
  116.     }
  117.     return 0;
  118. }
  119.  
  120. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  121. {
  122.     return 1;
  123. }
  124.  
  125. public OnPlayerExitVehicle(playerid, vehicleid)
  126. {
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerStateChange(playerid, newstate, oldstate)
  131. {
  132.     return 1;
  133. }
  134.  
  135. public OnPlayerEnterCheckpoint(playerid)
  136. {
  137.     return 1;
  138. }
  139.  
  140. public OnPlayerLeaveCheckpoint(playerid)
  141. {
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerEnterRaceCheckpoint(playerid)
  146. {
  147.     return 1;
  148. }
  149.  
  150. public OnPlayerLeaveRaceCheckpoint(playerid)
  151. {
  152.     return 1;
  153. }
  154.  
  155. public OnRconCommand(cmd[])
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnPlayerRequestSpawn(playerid)
  161. {
  162.     return 1;
  163. }
  164.  
  165. public OnObjectMoved(objectid)
  166. {
  167.     return 1;
  168. }
  169.  
  170. public OnPlayerObjectMoved(playerid, objectid)
  171. {
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerPickUpPickup(playerid, pickupid)
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnVehicleMod(playerid, vehicleid, componentid)
  181. {
  182.     return 1;
  183. }
  184.  
  185. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  186. {
  187.     return 1;
  188. }
  189.  
  190. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  191. {
  192.     return 1;
  193. }
  194.  
  195. public OnPlayerSelectedMenuRow(playerid, row)
  196. {
  197.     return 1;
  198. }
  199.  
  200. public OnPlayerExitedMenu(playerid)
  201. {
  202.     return 1;
  203. }
  204.  
  205. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  206. {
  207.     return 1;
  208. }
  209.  
  210. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnPlayerUpdate(playerid)
  216. {
  217.     return 1;
  218. }
  219.  
  220.  
  221.  
Advertisement
Add Comment
Please, Sign In to add comment