Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 36.24 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  *  __  __ ________ __ ______ ______
  3.  * |  |/  |  |  |  |__|   __ \   __ \
  4.  * |     <|  |  |  |__|      <    __/
  5.  * |__|\__|________|__|___|__|___|
  6.  *          Keywork Roleplay
  7.  *               v0.0.1
  8.  */
  9.  
  10. // [ Main Includes ]
  11. #include <a_samp>
  12. #include <a_mysql>
  13. #include <zcmd>
  14. #include <Encrypt>
  15. #include <sscanf2>
  16. // [ Main Includes ]
  17.  
  18. // [ Server Info ]
  19. #define SERVER_VERSION      "v0.01"
  20. #define SERVER_LASTUPDATED  "30/06/2012"
  21.  
  22. #define SQL_HOST            "127.0.0.1"
  23. #define SQL_USER            "samp"
  24. #define SQL_PASS            "#############"
  25. #define SQL_DB              "samp"
  26. // [ Server Info ]
  27.  
  28. // [ Colors ]
  29. #define COLOR_WHITE         0xFFFFFFFF
  30. #define COLOR_RED           0xFF0000FF
  31. #define COLOR_GREEN         0x00FF00FF
  32. #define COLOR_BLUE          0x0000FFFF
  33. #define COLOR_YELLOW        0xFFFF00FF
  34. #define COLOR_PURPLE        0xFF00FFFF
  35. #define COLOR_TEAL          0x00FFFFFF
  36.  
  37. #define COLOR_ADMIN         0x58C6E8FF
  38.  
  39. // new special colours
  40. #define COL_WHITE           "{FFFFFF}"
  41. #define COL_RED             "{FF0000}"
  42. #define COL_GREEN           "{00FF00}"
  43. #define COL_BLUE            "{0000FF}"
  44. #define COL_YELLOW          "{FFFF00}"
  45. #define COL_PURPLE          "{00FFFF}"
  46.  
  47. #define COL_ADMIN           "{58C6E8}"
  48. // [ Colors ]
  49.  
  50. // [ Dialogs ]
  51. #define DIALOG_REGISTER                 0
  52. #define DIALOG_LOGIN                    1
  53. #define DIALOG_SET_ADMIN_NAME       2
  54.  
  55. #define DIALOG_TUTORIAL1            3
  56. #define DIALOG_TUTORIAL2            4
  57. #define DIALOG_TUTORIAL3            5
  58. #define DIALOG_TUTORIAL4            6
  59. #define DIALOG_TUTORIAL5            7
  60.  
  61. #define DIALOG_CCREATION1                       8
  62. #define DIALOG_CCREATION2           9
  63. #define DIALOG_CCREATION3           10
  64. #define DIALOG_CCREATION4           11
  65. #define DIALOG_CCREATION5           12
  66. #define DIALOG_CCREATION6           13
  67. // [ Dialogs ]
  68.  
  69. // [ Player Enum ]
  70. enum pInfo
  71. {
  72.         pId,                            // active session id
  73.         pName[MAX_PLAYER_NAME],         // with_underscores
  74.         pRPName[MAX_PLAYER_NAME],       // without underscores
  75.         pLogged,                        // whether or not the player is logged
  76.         pIp[15],                        // active session IP
  77.        
  78.         pAccountType,                   // 0 if player, 1 if admin
  79.         pAdminLevel,
  80.        
  81.         pNew,                           // 1 if player is new
  82.        
  83.         Float:pX,
  84.         Float:pY,
  85.         Float:pZ,
  86.         Float:pAngle,
  87.        
  88.         Float:pHealth,
  89.         Float:pArmour,
  90.         pMoney,
  91.         pSkin,
  92.        
  93.         pAge,
  94.         pGender,
  95. }
  96.  
  97. new PlayerInfo[MAX_PLAYERS][pInfo];
  98. // [ Player Enum ]
  99.  
  100. // [ Forward Declarations ]
  101. forward ConnectMySQL();
  102. forward LoadPlayer(playerid);
  103. forward SavePlayer(playerid);
  104. forward ServerRestart();
  105. // [ Forward Declarations ]
  106.  
  107. main()
  108. {
  109.         print("\n");
  110.  
  111.         print("  __  __ ________ __ ______ ______");
  112.         print(" |  |/  |  |  |  |__|   __ \\   __ \\");
  113.         print(" |     <|  |  |  |__|      <    __/");
  114.         print(" |__|\\__|________|__|___|__|___|");
  115.         print("          Keywork Roleplay");
  116.         new buf[20];
  117.         format(buf, sizeof(buf), "               %s", SERVER_VERSION);
  118.         print("               v0.0.1");
  119.  
  120.         print("\n");
  121.         return 1;
  122. }
  123.  
  124. public OnGameModeInit()
  125. {
  126.         new gm[20];
  127.         format(gm, sizeof(gm), "KW:RP %s", SERVER_VERSION);
  128.         SetGameModeText(gm);
  129.        
  130.         new mysql = ConnectMySQL();
  131.        
  132.         if (mysql == 0)
  133.         {
  134.                 print("Failed to make a MySQL connection.");
  135.                 return 0;
  136.         }
  137.        
  138.         DisableInteriorEnterExits();
  139.         ShowPlayerMarkers(0);
  140.         EnableStuntBonusForAll(0);
  141.         UsePlayerPedAnims();
  142.        
  143.         CreateObject(16400,-2464.60009766,2225.30004883,3.79999995,0.00000000,0.00000000,270.00000000); //taxi company hq
  144.         CreateObject(994,-2280.30004883,2279.00000000,4.00000000,0.00000000,0.00000000,0.00000000); //sasd parking barrier(1)
  145.         CreateObject(994,-2273.80004883,2279.00000000,4.00000000,0.00000000,0.00000000,0.00000000); //sasd parking barrier(2)
  146.         CreateObject(994,-2267.30004883,2279.00000000,4.00000000,0.00000000,0.00000000,0.00000000); //sasd parking barrier(3)
  147.         CreateObject(994,-2260.69995117,2279.00000000,4.00000000,0.00000000,0.00000000,0.00000000); //sasd parking barrier(4)
  148.         CreateObject(994,-2254.10009766,2279.00000000,4.00000000,0.00000000,0.00000000,0.00000000); //sasd parking barrier(5)
  149.         CreateObject(994,-2280.30004883,2279.50000000,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(26)
  150.         CreateObject(994,-2280.30004883,2286.10009766,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(25)
  151.         CreateObject(994,-2280.30004883,2292.69995117,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(24)
  152.         CreateObject(994,-2280.30004883,2299.30004883,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(23)
  153.         CreateObject(994,-2280.30004883,2305.89990234,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(22)
  154.         CreateObject(994,-2280.30004883,2312.50000000,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(21)
  155.         CreateObject(994,-2280.30004883,2319.10009766,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(20)
  156.         CreateObject(994,-2280.30004883,2325.69995117,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(19)
  157.         CreateObject(994,-2280.30004883,2332.30004883,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(18)
  158.         CreateObject(994,-2280.30004883,2338.89990234,4.00000000,0.00000000,0.00000000,90.00000000); //sasd parking barrier(17)
  159.         CreateObject(967,-2278.19995117,2348.30004883,4.00000000,0.00000000,0.00000000,145.74996948); //sasd parking gate house
  160.         CreateObject(968,-2277.81054688,2348.99218750,4.77500105,0.00000000,90.00000000,54.24499512); //sasd parking gate
  161.         CreateObject(994,-2247.50000000,2279.00000000,4.00000000,0.00000000,0.00000000,54.00000000); //sasd parking barrier(6)
  162.         CreateObject(994,-2244.00000000,2310.60009766,4.00000000,0.00000000,0.00000000,89.99780273); //sasd parking barrier(7)
  163.         CreateObject(994,-2244.00000000,2317.30004883,4.00000000,0.00000000,0.00000000,89.99450684); //sasd parking barrier(8)
  164.         CreateObject(994,-2244.00000000,2330.00000000,4.00000000,0.00000000,0.00000000,89.99450684); //sasd parking barrier(9)
  165.         CreateObject(994,-2244.00000000,2336.69995117,4.00000000,0.00000000,0.00000000,89.99450684); //sasd parking barrier(10)
  166.         CreateObject(994,-2244.39990234,2343.19995117,4.00000000,0.00000000,0.00000000,143.99456787); //sasd parking barrier(11)
  167.         CreateObject(994,-2249.80004883,2347.10009766,4.00000000,0.00000000,0.00000000,143.99230957); //sasd parking barrier(12)
  168.         CreateObject(994,-2255.10009766,2351.00000000,4.00000000,0.00000000,0.00000000,143.99230957); //sasd parking barrier(13)
  169.         CreateObject(994,-2260.39990234,2354.80004883,4.00000000,0.00000000,0.00000000,143.99230957); //sasd parking barrier(14)
  170.         CreateObject(994,-2265.69921875,2358.59960938,4.00000000,0.00000000,0.00000000,187.99206543); //sasd parking barrier(15)
  171.         CreateObject(11451,-2232.19995117,2296.50000000,4.40000010,0.00000000,0.00000000,330.00000000); //sasd hq
  172.         CreateObject(997,-2272.19995117,2357.60009766,4.00000000,0.00000000,0.00000000,234.00000000); //sasd parking barrier(27)
  173.         CreateObject(997,-2280.80004883,2345.39990234,4.00000000,0.00000000,0.00000000,53.99780273); //sasd parking barrier(28)
  174.         CreateObject(11454,-2612.76147461,2258.10180664,7.21093750,0.00000000,0.00000000,0.00000000); //ems hq
  175.  
  176.         return 1;
  177. }
  178.  
  179. public ConnectMySQL()
  180. {
  181.         mysql_debug(1);
  182.         mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
  183.        
  184.         if (mysql_ping() != 1)
  185.             return 0;
  186.         return 1;
  187. }
  188.  
  189. public OnGameModeExit()
  190. {
  191.         mysql_close();
  192.         return 1;
  193. }
  194.  
  195. public OnPlayerRequestClass(playerid, classid)
  196. {
  197.         PlayerInfo[playerid][pId] = playerid;
  198.         GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
  199.         GetRPName(playerid, PlayerInfo[playerid][pRPName]);
  200.         GetPlayerIp(playerid, PlayerInfo[playerid][pIp], 15);
  201.         PlayerInfo[playerid][pLogged] = 0;
  202.  
  203.     SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
  204.     TogglePlayerSpectating(playerid, true);
  205.  
  206.         ClearChat(playerid);
  207.        
  208.         new msg[256];
  209.         format(msg, sizeof(msg), "» Welcome to Keywork Roleplay, %s!", PlayerInfo[playerid][pRPName]);
  210.         SendClientMessage(playerid, COLOR_YELLOW, msg);
  211.         format(msg, sizeof(msg), "» Running KW:RP %s", SERVER_VERSION);
  212.         SendClientMessage(playerid, COLOR_YELLOW, msg);
  213.         format(msg, sizeof(msg), "» Last updated on: %s", SERVER_LASTUPDATED);
  214.         SendClientMessage(playerid, COLOR_YELLOW, msg);
  215.        
  216.         SendClientMessage(playerid, COLOR_WHITE, " ");
  217.         SendClientMessage(playerid, COLOR_YELLOW, "Looking up your account..");
  218.         SendClientMessage(playerid, COLOR_WHITE, " ");
  219.  
  220.         new query[256];
  221.         format(query, sizeof(query), "SELECT * FROM users WHERE name='%s'", PlayerInfo[playerid][pName]);
  222.         mysql_store_result(mysql_query(query));
  223.         new rows = mysql_num_rows();
  224.  
  225.         if (rows == 0)
  226.         {
  227.             format(msg, sizeof(msg), "No account with the name '%s' was found in our database.", PlayerInfo[playerid][pName]);
  228.                 SendClientMessage(playerid, COLOR_YELLOW, msg);
  229.                 SendClientMessage(playerid, COLOR_YELLOW, "You may now proceed to register.");
  230.                 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Please enter your desired password.", "Register", "Exit");
  231.         }
  232.         if (rows == 1)
  233.         {
  234.             format(msg, sizeof(msg), "The account '%s' already exists within our database.", PlayerInfo[playerid][pName]);
  235.             SendClientMessage(playerid, COLOR_YELLOW, msg);
  236.             SendClientMessage(playerid, COLOR_YELLOW, "If this is you, please login. Otherwise, please choose a different name.");
  237.             SendClientMessage(playerid, COLOR_WHITE, " ");
  238.             ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password.", "Login", "Exit");
  239.         }
  240.  
  241.         return 1;
  242. }
  243.  
  244. public OnPlayerConnect(playerid)
  245. {
  246.         new name[MAX_PLAYER_NAME];
  247.         GetPlayerName(playerid, name, sizeof(name));
  248.        
  249.         if (!IsRPName(name, 2))
  250.         {
  251.             SendClientMessage(playerid, COLOR_RED, "Your name is not in the correct format, please change it.");
  252.             SendClientMessage(playerid, COLOR_RED, "i.e John_Smith");
  253.             Kick(playerid);
  254.             return 0;
  255.         }
  256.  
  257.         return 1;
  258. }
  259.  
  260. public OnPlayerDisconnect(playerid, reason)
  261. {
  262.         if (PlayerInfo[playerid][pLogged] == 1)
  263.             SavePlayer(playerid);
  264.  
  265.         return 1;
  266. }
  267.  
  268. public OnPlayerSpawn(playerid)
  269. {
  270.         if (PlayerInfo[playerid][pNew] == 1)
  271.         {
  272.             PlayerInfo[playerid][pLogged] = 1;
  273.             TogglePlayerSpectating(playerid, true);
  274.             new msg[256];
  275.             format(msg, sizeof(msg), "%sKW:RP %s\n\n%sWelcome to Keywork Roleplay, and thank you for choosing to play here.\n", COL_ADMIN, SERVER_VERSION, COL_WHITE);
  276.             format(msg, sizeof(msg), "%sPlease follow this short tutorial sequence, and then you'll be ready to play!", msg);
  277.            
  278.             ShowPlayerDialog(playerid, DIALOG_TUTORIAL1, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Exit");
  279.         }
  280.  
  281.         return 1;
  282. }
  283.  
  284. public OnPlayerDeath(playerid, killerid, reason)
  285. {
  286.         SendClientMessage(playerid, COLOR_ADMIN, "Why'd you have to die?");
  287.         SendClientMessage(playerid, COLOR_ADMIN, "It's not even properly scripted in yet..");
  288.         SendClientMessage(playerid, COLOR_WHITE, " ");
  289.  
  290.         SetPlayerHealth(playerid, 50);
  291.         SetPlayerPos(playerid, -2615.135986, 2273.914794, 8.10937);
  292.         SetPlayerFacingAngle(playerid, 358.635131);
  293.  
  294.         SendClientMessage(playerid, COLOR_RED, "$500 has been deducted from you due to hospital fees.");
  295.         GivePlayerMoney(playerid, -500);
  296.  
  297.         return 0;
  298. }
  299.  
  300. public OnVehicleSpawn(vehicleid)
  301. {
  302.         return 1;
  303. }
  304.  
  305. public OnVehicleDeath(vehicleid, killerid)
  306. {
  307.         return 1;
  308. }
  309.  
  310. public OnPlayerText(playerid, text[])
  311. {
  312.         return 1;
  313. }
  314.  
  315. public OnPlayerCommandText(playerid, cmdtext[])
  316. {
  317.         return 0;
  318. }
  319.  
  320. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  321. {
  322.         return 1;
  323. }
  324.  
  325. public OnPlayerExitVehicle(playerid, vehicleid)
  326. {
  327.         return 1;
  328. }
  329.  
  330. public OnPlayerStateChange(playerid, newstate, oldstate)
  331. {
  332.         return 1;
  333. }
  334.  
  335. public OnPlayerEnterCheckpoint(playerid)
  336. {
  337.         return 1;
  338. }
  339.  
  340. public OnPlayerLeaveCheckpoint(playerid)
  341. {
  342.         return 1;
  343. }
  344.  
  345. public OnPlayerEnterRaceCheckpoint(playerid)
  346. {
  347.         return 1;
  348. }
  349.  
  350. public OnPlayerLeaveRaceCheckpoint(playerid)
  351. {
  352.         return 1;
  353. }
  354.  
  355. public OnRconCommand(cmd[])
  356. {
  357.         return 1;
  358. }
  359.  
  360. public OnPlayerRequestSpawn(playerid)
  361. {
  362.         return 1;
  363. }
  364.  
  365. public OnObjectMoved(objectid)
  366. {
  367.         return 1;
  368. }
  369.  
  370. public OnPlayerObjectMoved(playerid, objectid)
  371. {
  372.         return 1;
  373. }
  374.  
  375. public OnPlayerPickUpPickup(playerid, pickupid)
  376. {
  377.         return 1;
  378. }
  379.  
  380. public OnVehicleMod(playerid, vehicleid, componentid)
  381. {
  382.         return 1;
  383. }
  384.  
  385. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  386. {
  387.         return 1;
  388. }
  389.  
  390. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  391. {
  392.         return 1;
  393. }
  394.  
  395. public OnPlayerSelectedMenuRow(playerid, row)
  396. {
  397.         return 1;
  398. }
  399.  
  400. public OnPlayerExitedMenu(playerid)
  401. {
  402.         return 1;
  403. }
  404.  
  405. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  406. {
  407.         return 1;
  408. }
  409.  
  410. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  411. {
  412.         return 1;
  413. }
  414.  
  415. public OnRconLoginAttempt(ip[], password[], success)
  416. {
  417.         return 1;
  418. }
  419.  
  420. public OnPlayerUpdate(playerid)
  421. {
  422.         return 1;
  423. }
  424.  
  425. public OnPlayerStreamIn(playerid, forplayerid)
  426. {
  427.         return 1;
  428. }
  429.  
  430. public OnPlayerStreamOut(playerid, forplayerid)
  431. {
  432.         return 1;
  433. }
  434.  
  435. public OnVehicleStreamIn(vehicleid, forplayerid)
  436. {
  437.         return 1;
  438. }
  439.  
  440. public OnVehicleStreamOut(vehicleid, forplayerid)
  441. {
  442.         return 1;
  443. }
  444.  
  445. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  446. {
  447.         switch (dialogid)
  448.         {
  449.             case DIALOG_REGISTER:
  450.             {
  451.                 if (!response)
  452.                     Kick(playerid);
  453.  
  454.                         new hash[41];
  455.                         sha1(inputtext, hash);
  456.                        
  457.                         new ip[15];
  458.                         GetPlayerIp(playerid, ip, sizeof(ip));
  459.                        
  460.                         new query[256];
  461.                         format(query, sizeof(query), "INSERT INTO users (name, password, regip) VALUES ('%s', '%s', '%s')",
  462.                             PlayerInfo[playerid][pName], hash, PlayerInfo[playerid][pIp]);
  463.             mysql_query("ALTER TABLE users AUTO_INCREMENT = 1;");
  464.             mysql_query(query);
  465.            
  466.             SendClientMessage(playerid, COLOR_YELLOW, "You have successfully registered.");
  467.             SendClientMessage(playerid, COLOR_YELLOW, "You may now log in with the password you chose.");
  468.             SendClientMessage(playerid, COLOR_WHITE, " ");
  469.             ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password.", "Login", "Exit");
  470.             }
  471.            
  472.             case DIALOG_LOGIN:
  473.             {
  474.                 if (!response)
  475.                     Kick(playerid);
  476.  
  477.                         new inputhash[41];
  478.                         sha1(inputtext, inputhash);
  479.                         new query[256];
  480.                         format(query, sizeof(query), "SELECT * FROM users WHERE name='%s' AND password='%s'",
  481.                             PlayerInfo[playerid][pName], inputhash);
  482.                         mysql_store_result(mysql_query(query));
  483.                         new correct = mysql_num_rows();
  484.                        
  485.                         if (correct == 0)
  486.                         {
  487.                             SendClientMessage(playerid, COLOR_RED, "The password you entered was incorrect.");
  488.                             ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password.", "Login", "Exit");
  489.                         }
  490.                         if (correct == 1)
  491.                         {
  492.                             SendClientMessage(playerid, COLOR_GREEN, "You have successfully logged in.");
  493.                                 format(query, sizeof(query), "UPDATE users SET lastip='%s' WHERE name='%s'",
  494.                                     PlayerInfo[playerid][pIp], PlayerInfo[playerid][pName]);
  495.                                 mysql_query(query);
  496.                                
  497.                                 LoadPlayer(playerid);
  498.                                 SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ], PlayerInfo[playerid][pAngle],
  499.                                         0, 0, 0, 0, 0, 0);
  500.                                 SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
  501.                                 SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
  502.                                 GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
  503.  
  504.                                 if (PlayerInfo[playerid][pAccountType] == 1)
  505.                                     SetPlayerColor(playerid, COLOR_ADMIN);
  506.                                 else
  507.                                     SetPlayerColor(playerid, COLOR_WHITE);
  508.  
  509.                                 PlayerInfo[playerid][pLogged] = 1;
  510.                                 TogglePlayerSpectating(playerid, false);
  511.                                 SpawnPlayer(playerid);
  512.                         }
  513.             }
  514.            
  515.             case DIALOG_TUTORIAL1:
  516.             {
  517.                 if (!response)
  518.                     Kick(playerid);
  519.  
  520.                         new msg[256];
  521.                         format(msg, sizeof(msg), "%sHow does our server differ from others?\n\n%s", COL_YELLOW, COL_WHITE);
  522.                         format(msg, sizeof(msg), "%sFirstly, KW:RP is based solely on an economy, and everything effects this economy.\n", msg);
  523.                         format(msg, sizeof(msg), "%sBecause of this, we can offer a truly dynamic world to roleplay within.\n", msg);
  524.                         ShowPlayerDialog(playerid, DIALOG_TUTORIAL2, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Back");
  525.             }
  526.            
  527.             case DIALOG_TUTORIAL2:
  528.             {
  529.                 new msg[256];
  530.                 if (!response)
  531.                 {
  532.                 format(msg, sizeof(msg), "%sKW:RP %s\n\n%sWelcome to Keywork Roleplay, and thank you for choosing to play here.\n", COL_ADMIN, SERVER_VERSION, COL_WHITE);
  533.                                 format(msg, sizeof(msg), "%sPlease follow this short tutorial sequence, and then you'll be ready to play!", msg);
  534.                                 ShowPlayerDialog(playerid, DIALOG_TUTORIAL1, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Exit");
  535.                                 return 1;
  536.                 }
  537.  
  538.                         format(msg, sizeof(msg), "%sThis also allows players to obtain things quicker and reap the short-term benefits.\n", COL_WHITE);
  539.                         format(msg, sizeof(msg), "%sHowever, as you might expect, over a long period of time you will start to feel the effects\n", msg);
  540.                         format(msg, sizeof(msg), "%sof the mortgage or loan you took out.", msg);
  541.                         ShowPlayerDialog(playerid, DIALOG_TUTORIAL3, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Back");
  542.             }
  543.            
  544.             case DIALOG_TUTORIAL3:
  545.             {
  546.                 new msg[256];
  547.                 if (!response)
  548.                 {
  549.                                 format(msg, sizeof(msg), "%sHow does our server differ from others?\n\n%s", COL_YELLOW, COL_WHITE);
  550.                                 format(msg, sizeof(msg), "%sFirstly, KW:RP is based solely on an economy, and everything effects this economy.\n", msg);
  551.                                 format(msg, sizeof(msg), "%sBecause of this, we can offer a truly dynamic world to roleplay within.\n", msg);
  552.                                 ShowPlayerDialog(playerid, DIALOG_TUTORIAL2, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Back");
  553.                                 return 1;
  554.                 }
  555.                
  556.                 format(msg, sizeof(msg), "%sServer Rules\n\n", COL_RED);
  557.                 format(msg, sizeof(msg), "%s%sAs of current, we don't have a defined ruleset.\n", msg, COL_WHITE);
  558.                 format(msg, sizeof(msg), "%sHowever, we expect you to be as realistic as possible and avoid things like metagaming & powergaming.", msg);
  559.                 ShowPlayerDialog(playerid, DIALOG_TUTORIAL4, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Back");
  560.             }
  561.            
  562.             case DIALOG_TUTORIAL4:
  563.             {
  564.                 new msg[256];
  565.                 if (!response)
  566.                 {
  567.                                 format(msg, sizeof(msg), "%sThis also allows players to obtain things quicker and reap the short-term benefits.\n", COL_WHITE);
  568.                                 format(msg, sizeof(msg), "%sHowever, as you might expect, over a long period of time you will start to feel the effects\n", msg);
  569.                                 format(msg, sizeof(msg), "%sof the mortgage or loan you took out.", msg);
  570.                                 ShowPlayerDialog(playerid, DIALOG_TUTORIAL3, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Back");
  571.                                 return 1;
  572.                 }
  573.                
  574.                 format(msg, sizeof(msg), "%sSo what do I do now?\n\n", COL_YELLOW);
  575.                 format(msg, sizeof(msg), "%s%sYou proceed to character creation, but most of all, you have fun =)", msg, COL_WHITE);
  576.                 ShowPlayerDialog(playerid, DIALOG_TUTORIAL5, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Begin", "Back");
  577.             }
  578.            
  579.             case DIALOG_TUTORIAL5:
  580.             {
  581.                 new msg[256];
  582.                 if (!response)
  583.                 {
  584.                         format(msg, sizeof(msg), "%sServer Rules\n\n", COL_RED);
  585.                         format(msg, sizeof(msg), "%s%sAs of current, we don't have a defined ruleset.\n", msg, COL_WHITE);
  586.                         format(msg, sizeof(msg), "%sHowever, we expect you to be as realistic as possible and avoid things like metagaming & powergaming.", msg);
  587.                         ShowPlayerDialog(playerid, DIALOG_TUTORIAL4, DIALOG_STYLE_MSGBOX, "KW:RP Tutorial", msg, "Next", "Back");
  588.                         return 1;
  589.                 }
  590.                
  591.                 new fname[MAX_PLAYER_NAME];
  592.                 GetFirstName(playerid, fname);
  593.                 format(msg, sizeof(msg), "%sHey there, %s!\n\n", COL_WHITE, fname);
  594.                 format(msg, sizeof(msg), "%sWelcome to our small little town, Bayside.", msg);
  595.                 ShowPlayerDialog(playerid, DIALOG_CCREATION1, DIALOG_STYLE_MSGBOX, "Character Creation", msg, "Next", "Exit");
  596.             }
  597.            
  598.             case DIALOG_CCREATION1:
  599.             {
  600.                 new msg[256];
  601.                 if (!response)
  602.                         Kick(playerid);
  603.  
  604.                         format(msg, sizeof(msg), "%sBayside is a small town nestled in the north western corner of the state that never really got going.\n", COL_WHITE);
  605.                         format(msg, sizeof(msg), "%sIt was a meant as a suburb of San Fierro, but that was before 1905 when the great quake levelled most of the state.\n", msg);
  606.                         //format(msg, sizeof(msg), "%sIt'd be around that time when Bayside went it's own way, rejecting the new San Fierro in 1909.\n", msg);
  607.                         //format(msg, sizeof(msg), "%sThe main force of law in Bayside has always been the Sherrif's Department, formed from the Bayside citizens themselves.", msg);
  608.                         ShowPlayerDialog(playerid, DIALOG_CCREATION2, DIALOG_STYLE_MSGBOX, "Character Creation", msg, "Next", "Exit");
  609.             }
  610.            
  611.             case DIALOG_CCREATION2:
  612.             {
  613.                         new msg[256];
  614.                         if (!response)
  615.                             Kick(playerid);
  616.                            
  617.             format(msg, sizeof(msg), "%sIt'd be around that time when Bayside went it's own way, rejecting the new San Fierro in 1909.\n", COL_WHITE);
  618.                         format(msg, sizeof(msg), "%sThe main force of law in Bayside has always been the Sherrif's Department, formed from the Bayside citizens themselves.", msg);
  619.                         ShowPlayerDialog(playerid, DIALOG_CCREATION3, DIALOG_STYLE_MSGBOX, "Character Creation", msg, "Next", "Exit");
  620.             }
  621.            
  622.             case DIALOG_CCREATION3:
  623.             {
  624.                 new msg[256];
  625.                 if (!response)
  626.                     Kick(playerid);
  627.                    
  628.                         format(msg, sizeof(msg), "%sAnyhow, enough of that.\nAre you male or female?", COL_WHITE);
  629.                         ShowPlayerDialog(playerid, DIALOG_CCREATION4, DIALOG_STYLE_INPUT, "Character Creation", msg, "Next", "Exit");
  630.             }
  631.            
  632.             case DIALOG_CCREATION4:
  633.             {
  634.                 new msg[256];
  635.                 if (!response)
  636.                     Kick(playerid);
  637.                    
  638.                         if (strcmp(inputtext, "male", true) == 0)
  639.                         {
  640.                             PlayerInfo[playerid][pGender] = 0;
  641.                         }
  642.                         else if (strcmp(inputtext, "female", true) == 0)
  643.                         {
  644.                                 PlayerInfo[playerid][pGender] = 1;
  645.                         }
  646.                         else
  647.                         {
  648.                                 format(msg, sizeof(msg), "%sHuh? Is that English buddy?\n", COL_WHITE);
  649.                                 format(msg, sizeof(msg), "%s%s(( You must type either Male or Female ))", msg, COL_YELLOW);
  650.                                 ShowPlayerDialog(playerid, DIALOG_CCREATION4, DIALOG_STYLE_INPUT, "Character Creation", msg, "Next", "Exit");
  651.                                 return 1;
  652.                         }
  653.                        
  654.                         format(msg, sizeof(msg), "%sRight, and if you don't mind me askin', how old are ya?", COL_WHITE);
  655.                         ShowPlayerDialog(playerid, DIALOG_CCREATION5, DIALOG_STYLE_INPUT, "Character Creation", msg, "Next", "Exit");
  656.             }
  657.            
  658.             case DIALOG_CCREATION5:
  659.             {
  660.                 new msg[256];
  661.                 if (!response)
  662.                     Kick(playerid);
  663.                    
  664.                         if (!IsNumeric(inputtext))
  665.                         {
  666.                             format(msg, sizeof(msg), "%sI understand ya not wanting me to know your age, but you can't just go around with all these secrets!\n", COL_WHITE);
  667.                             format(msg, sizeof(msg), "%s%s(( The age entered must be a number, and it is your character's age - not yours. ))", msg, COL_YELLOW);
  668.                             ShowPlayerDialog(playerid, DIALOG_CCREATION5, DIALOG_STYLE_INPUT, "Character Creation", msg, "Next", "Exit");
  669.                             return 1;
  670.                         }
  671.                        
  672.                         new age = strval(inputtext);
  673.                        
  674.                         if (age > 60)
  675.                         {
  676.                             format(msg, sizeof(msg), "%s*chuckles*, you don't seem that old!\n", COL_WHITE);
  677.                             format(msg, sizeof(msg), "%s%s(( Your age must be below 60! ))", msg, COL_YELLOW);
  678.                             ShowPlayerDialog(playerid, DIALOG_CCREATION5, DIALOG_STYLE_INPUT, "Character Creation", msg, "Next", "Exit");
  679.                             return 1;
  680.                         }
  681.                        
  682.                         if (age < 18)
  683.                         {
  684.                             format(msg, sizeof(msg), "%sYou can't be that young, and movin' about the world!\n", COL_WHITE);
  685.                             format(msg, sizeof(msg), "%s%s(( Your age must be above 18! ))", msg, COL_YELLOW);
  686.                             ShowPlayerDialog(playerid, DIALOG_CCREATION5, DIALOG_STYLE_INPUT, "Character Creation", msg, "Next", "Exit");
  687.                             return 1;
  688.                         }
  689.                        
  690.                         PlayerInfo[playerid][pAge] = age;
  691.                         format(msg, sizeof(msg), "%sRighto, looks like you're ready to get settled in to Bayside!\n", COL_WHITE);
  692.                         format(msg, sizeof(msg), "%s%s(( If you messed something up during character creation, hit exit and log back in to redo it ))", msg, COL_YELLOW);
  693.                         ShowPlayerDialog(playerid, DIALOG_CCREATION6, DIALOG_STYLE_MSGBOX, "Character Creation", msg, "Start", "Exit");
  694.             }
  695.            
  696.             case DIALOG_CCREATION6:
  697.             {
  698.                         if (PlayerInfo[playerid][pGender] == 0)
  699.                             PlayerInfo[playerid][pSkin] = 26;
  700.                         if (PlayerInfo[playerid][pGender] == 1)
  701.                             PlayerInfo[playerid][pSkin] = 12;
  702.  
  703.                         SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  704.  
  705.                         PlayerInfo[playerid][pNew] = 0;
  706.                         PlayerInfo[playerid][pLogged] = 1;
  707.                         SavePlayer(playerid);
  708.                         LoadPlayer(playerid);
  709.                         SpawnPlayer(playerid);
  710.                         TogglePlayerSpectating(playerid, false);
  711.  
  712.                         if (!response)
  713.                             Kick(playerid);
  714.             }
  715.         }
  716.  
  717.         return 1;
  718. }
  719.  
  720. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  721. {
  722.         return 1;
  723. }
  724.  
  725. // [ Stock Functions ]
  726. stock IsRPName(const name[], max_underscores = 2)
  727. {
  728.     new underscores = 0;
  729.     if (name[0] < 'A' || name[0] > 'Z') return false;
  730.     for(new i = 1; i < strlen(name); i++)
  731.     {
  732.         if(name[i] != '_' && (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) return false;
  733.         if( (name[i] >= 'A' && name[i] <= 'Z') && (name[i - 1] != '_') ) return false;
  734.         if(name[i] == '_')
  735.         {
  736.             underscores++;
  737.             if(underscores > max_underscores || i == strlen(name)) return false;
  738.             if(name[i + 1] < 'A' || name[i + 1] > 'Z') return false;
  739.         }
  740.     }
  741.     if (underscores == 0) return false;
  742.     return true;
  743. }
  744.  
  745. stock GetRPName(playerid, name[])
  746. {
  747.         new buf[MAX_PLAYER_NAME];
  748.         GetPlayerName(playerid, buf, sizeof(buf));
  749.  
  750.         for (new i = 0; i < sizeof(buf); i++)
  751.         {
  752.                 if (buf[i] == '_')
  753.                     name[i] = ' ';
  754.                 else
  755.                     name[i] = buf[i];
  756.         }
  757. }
  758.  
  759. stock ClearChat(playerid)
  760. {
  761.         for (new i = 0; i < 20; i++)
  762.         {
  763.             SendClientMessage(playerid, COLOR_WHITE, " ");
  764.         }
  765. }
  766.  
  767. stock GetFirstName(playerid, name[])
  768. {
  769.         new name2[MAX_PLAYER_NAME];
  770.         format(name2, sizeof(name2), "%s", PlayerInfo[playerid][pName]);
  771.  
  772.         for (new i = 0; i < MAX_PLAYER_NAME; i++)
  773.         {
  774.             if (name2[i] == '_')
  775.                 break;
  776.                
  777.                 name[i] = name2[i];
  778.         }
  779. }
  780.  
  781. stock IsNumeric(const string[])
  782. {
  783.     for (new i = 0, j = strlen(string); i < j; i++)
  784.     {
  785.         if (string[i] > '9' || string[i] < '0') return 0;
  786.     }
  787.     return 1;
  788. }
  789. // [ Stock Functions ]
  790.  
  791. // [ Player Management ]
  792. public LoadPlayer(playerid)
  793. {
  794.         new query[256];
  795.         format(query, sizeof(query), "SELECT * FROM users WHERE name='%s'",
  796.             PlayerInfo[playerid][pName]);
  797.         mysql_store_result(mysql_query(query));
  798.         mysql_retrieve_row();
  799.         new buf[256];
  800.  
  801.         mysql_fetch_field_row(buf, "type");
  802.         PlayerInfo[playerid][pAccountType] = strval(buf);
  803.         mysql_fetch_field_row(buf, "adminlevel");
  804.         PlayerInfo[playerid][pAdminLevel] = strval(buf);
  805.         mysql_fetch_field_row(buf, "new");
  806.         PlayerInfo[playerid][pNew] = strval(buf);
  807.         mysql_fetch_field_row(buf, "x");
  808.         PlayerInfo[playerid][pX] = floatstr(buf);
  809.         mysql_fetch_field_row(buf, "y");
  810.         PlayerInfo[playerid][pY] = floatstr(buf);
  811.         mysql_fetch_field_row(buf, "z");
  812.         PlayerInfo[playerid][pZ] = floatstr(buf);
  813.         mysql_fetch_field_row(buf, "angle");
  814.         PlayerInfo[playerid][pAngle] = floatstr(buf);
  815.         mysql_fetch_field_row(buf, "health");
  816.         PlayerInfo[playerid][pHealth] = floatstr(buf);
  817.         mysql_fetch_field_row(buf, "armour");
  818.         PlayerInfo[playerid][pArmour] = floatstr(buf);
  819.         mysql_fetch_field_row(buf, "money");
  820.         PlayerInfo[playerid][pMoney] = strval(buf);
  821.         mysql_fetch_field_row(buf, "skin");
  822.         PlayerInfo[playerid][pSkin] = strval(buf);
  823.         mysql_fetch_field_row(buf, "age");
  824.         PlayerInfo[playerid][pAge] = strval(buf);
  825.         mysql_fetch_field_row(buf, "gender");
  826.         PlayerInfo[playerid][pGender] = strval(buf);
  827.        
  828.         mysql_free_result();
  829. }
  830.  
  831. public SavePlayer(playerid)
  832. {
  833.         GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
  834.         GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pAngle]);
  835.         GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
  836.         GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
  837.         PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
  838.         PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
  839.        
  840.         new query[256];
  841.         format(query, sizeof(query), "UPDATE users SET adminlevel=%i, new=%i, x=%f, y=%f, z=%f, angle=%f, health=%f, armour=%f, money=%i, skin=%i, age=%i, gender=%i WHERE name='%s'",
  842.         PlayerInfo[playerid][pAdminLevel], PlayerInfo[playerid][pNew], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ],
  843.         PlayerInfo[playerid][pAngle], PlayerInfo[playerid][pHealth], PlayerInfo[playerid][pArmour], PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pSkin],
  844.         PlayerInfo[playerid][pAge], PlayerInfo[playerid][pGender],
  845.         PlayerInfo[playerid][pName]);
  846.         mysql_query(query);
  847. }
  848. // [ Player Management ]
  849.  
  850. // [ Admin Section ]
  851. COMMAND:ahelp(playerid, params[])
  852. {
  853.         if (PlayerInfo[playerid][pLogged] == 0)
  854.             return 0;
  855.  
  856.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  857.             return 0;
  858.  
  859.         SendClientMessage(playerid, COLOR_ADMIN, "--");
  860.         if (PlayerInfo[playerid][pAdminLevel] >= 1)
  861.             SendClientMessage(playerid, COLOR_ADMIN, "COMMANDS :: /(a)chat /kick /freeze /thaw /goto /get");
  862.         if (PlayerInfo[playerid][pAdminLevel] >= 2)
  863.             SendClientMessage(playerid, COLOR_ADMIN, "COMMANDS :: /announce /slap /ban /setskin");
  864.         if (PlayerInfo[playerid][pAdminLevel] >= 3)
  865.             SendClientMessage(playerid, COLOR_ADMIN, "COMMANDS :: /ainvite /apromote /afire /spectate /specoff");
  866.     SendClientMessage(playerid, COLOR_ADMIN, "--");
  867.  
  868.         return 1;
  869. }
  870.  
  871. COMMAND:achat(playerid, params[])
  872. {
  873.         if (PlayerInfo[playerid][pLogged] == 0)
  874.             return 0;
  875.  
  876.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  877.                 return 0;
  878.                
  879.         new title[30];
  880.         if (PlayerInfo[playerid][pAdminLevel] == 1)
  881.                 format(title, sizeof(title), "Moderator");
  882.         if (PlayerInfo[playerid][pAdminLevel] == 2)
  883.             format(title, sizeof(title), "General Moderator");
  884.         if (PlayerInfo[playerid][pAdminLevel] == 3)
  885.             format(title, sizeof(title), "Administrator");
  886.  
  887.         new msg[256];
  888.         format(msg, sizeof(msg), "(( %s %s: %s ))", title, PlayerInfo[playerid][pRPName], params);
  889.        
  890.         for (new p = 0; p < MAX_PLAYERS; p++)
  891.         {
  892.             if (PlayerInfo[p][pAdminLevel] > 0 && PlayerInfo[p][pLogged] == 1)
  893.                 SendClientMessage(p, COLOR_ADMIN, msg);
  894.         }
  895.        
  896.         return 1;
  897. }
  898.  
  899. COMMAND:a(playerid, params[])
  900. {
  901.         return cmd_achat(playerid, params);
  902. }
  903.  
  904. COMMAND:kick(playerid, params[])
  905. {
  906.         if (PlayerInfo[playerid][pLogged] == 0)
  907.             return 0;
  908.  
  909.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  910.             return 0;
  911.  
  912.         if (PlayerInfo[playerid][pAdminLevel] >= 1)
  913.         {
  914.             new kid;
  915.             new reason[64];
  916.             new msg[256];
  917.            
  918.             if (sscanf(params, "us[64]", kid, reason))
  919.                 return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /kick <player> <reason>");
  920.  
  921.                 if (!IsPlayerConnected(kid))
  922.                     return SendClientMessage(playerid, COLOR_ADMIN, "Player is not connected!");
  923.                    
  924.                 format(msg, sizeof(msg), "[ADMIN] %s has been kicked from the server. Reason: %s (%s)", PlayerInfo[kid][pRPName], reason, PlayerInfo[playerid][pRPName]);
  925.                 SendClientMessageToAll(COLOR_RED, msg);
  926.                 Kick(kid);
  927.         }
  928.        
  929.         return 1;
  930. }
  931.  
  932. COMMAND:freeze(playerid, params[])
  933. {
  934.         if (PlayerInfo[playerid][pLogged] == 0)
  935.             return 0;
  936.  
  937.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  938.             return 0;
  939.            
  940.         if (PlayerInfo[playerid][pAdminLevel] >= 1)
  941.         {
  942.             new id;
  943.             new msg[256];
  944.            
  945.             if (sscanf(params, "u", id))
  946.                 return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /freeze <player>");
  947.                
  948.                 if (!IsPlayerConnected(id))
  949.                     return SendClientMessage(playerid, COLOR_ADMIN, "Player is not connected!");
  950.  
  951.                 format(msg, sizeof(msg), "You have been frozen by %s.", PlayerInfo[playerid][pRPName]);
  952.                 TogglePlayerControllable(id, false);
  953.                 SendClientMessage(id, COLOR_ADMIN, msg);
  954.                 format(msg, sizeof(msg), "You have frozen %s.", PlayerInfo[id][pRPName]);
  955.                 SendClientMessage(playerid, COLOR_ADMIN, msg);
  956.         }
  957.        
  958.         return 1;
  959. }
  960.  
  961. COMMAND:thaw(playerid, params[])
  962. {
  963.         if (PlayerInfo[playerid][pLogged] == 0)
  964.             return 0;
  965.  
  966.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  967.             return 0;
  968.  
  969.         if (PlayerInfo[playerid][pAdminLevel] >= 1)
  970.         {
  971.             new id;
  972.             new msg[256];
  973.  
  974.             if (sscanf(params, "u", id))
  975.                 return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /thaw <player>");
  976.  
  977.                 if (!IsPlayerConnected(id))
  978.                     return SendClientMessage(playerid, COLOR_ADMIN, "Player is not connected!");
  979.  
  980.                 format(msg, sizeof(msg), "You have been thawed by %s.", PlayerInfo[playerid][pRPName]);
  981.                 TogglePlayerControllable(id, true);
  982.                 SendClientMessage(id, COLOR_ADMIN, msg);
  983.                 format(msg, sizeof(msg), "You have thawed %s.", PlayerInfo[id][pRPName]);
  984.                 SendClientMessage(playerid, COLOR_ADMIN, msg);
  985.         }
  986.  
  987.         return 1;
  988. }
  989.  
  990. COMMAND:goto(playerid, params[])
  991. {
  992.         if (PlayerInfo[playerid][pLogged] == 0)
  993.             return 0;
  994.  
  995.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  996.             return 0;
  997.  
  998.         if (PlayerInfo[playerid][pAdminLevel] >= 1)
  999.         {
  1000.             new id;
  1001.                 new Float:x, Float:y, Float:z;
  1002.                 new msg[256];
  1003.                
  1004.                 if (sscanf(params, "u", id))
  1005.                     return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /goto <player>");
  1006.                    
  1007.                 if (!IsPlayerConnected(id))
  1008.                     return SendClientMessage(playerid, COLOR_ADMIN, "Player is not connected!");
  1009.  
  1010.                 GetPlayerPos(id, x, y, z);
  1011.                 SetPlayerPos(playerid, x, y, z);
  1012.  
  1013.                 format(msg, sizeof(msg), "%s has teleported to you!", PlayerInfo[playerid][pRPName]);
  1014.                 SendClientMessage(id, COLOR_ADMIN, msg);
  1015.                 format(msg, sizeof(msg), "You have teleported to %s.", PlayerInfo[id][pRPName]);
  1016.                 SendClientMessage(playerid, COLOR_ADMIN, msg);
  1017.         }
  1018.        
  1019.         return 1;
  1020. }
  1021.  
  1022. COMMAND:get(playerid, params[])
  1023. {
  1024.         if (PlayerInfo[playerid][pLogged] == 0)
  1025.             return 0;
  1026.  
  1027.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  1028.             return 0;
  1029.  
  1030.         if (PlayerInfo[playerid][pAdminLevel] >= 1)
  1031.         {
  1032.             new id;
  1033.                 new Float:x, Float:y, Float:z;
  1034.                 new msg[256];
  1035.  
  1036.                 if (sscanf(params, "u", id))
  1037.                     return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /get <player>");
  1038.  
  1039.                 if (!IsPlayerConnected(id))
  1040.                     return SendClientMessage(playerid, COLOR_ADMIN, "Player is not connected!");
  1041.  
  1042.                 GetPlayerPos(playerid, x, y, z);
  1043.                 SetPlayerPos(id, x, y, z);
  1044.  
  1045.                 format(msg, sizeof(msg), "%s has teleported you to them!", PlayerInfo[playerid][pRPName]);
  1046.                 SendClientMessage(id, COLOR_ADMIN, msg);
  1047.                 format(msg, sizeof(msg), "You have teleported %s to you", PlayerInfo[id][pRPName]);
  1048.                 SendClientMessage(playerid, COLOR_ADMIN, msg);
  1049.         }
  1050.  
  1051.         return 1;
  1052. }
  1053.  
  1054. COMMAND:announce(playerid, params[])
  1055. {
  1056.         if (PlayerInfo[playerid][pLogged] == 0)
  1057.             return 0;
  1058.  
  1059.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  1060.             return 0;
  1061.            
  1062.         if (PlayerInfo[playerid][pAdminLevel] >= 2)
  1063.         {
  1064.                 new msg[256];
  1065.                 format(msg, sizeof(msg), "(( Announcement by %s: %s ))", PlayerInfo[playerid][pRPName], params);
  1066.                 SendClientMessageToAll(COLOR_ADMIN, msg);
  1067.         }
  1068.        
  1069.         return 1;
  1070. }
  1071.  
  1072. COMMAND:slap(playerid, params[])
  1073. {
  1074.         return 0;
  1075. }
  1076.  
  1077. COMMAND:ban(playerid, params[])
  1078. {
  1079.         return 0;
  1080. }
  1081.  
  1082. COMMAND:setskin(playerid, params[])
  1083. {
  1084.         if (PlayerInfo[playerid][pLogged] == 0)
  1085.             return 0;
  1086.  
  1087.         if (PlayerInfo[playerid][pAdminLevel] == 0)
  1088.             return 0;
  1089.            
  1090.         if (PlayerInfo[playerid][pAdminLevel] >= 2)
  1091.         {
  1092.             new id;
  1093.                 new skin;
  1094.                 if (sscanf(params, "ui", id, skin))
  1095.                     return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /setskin <player> <skin>");
  1096.                    
  1097.                 if (!IsPlayerConnected(id))
  1098.                         return SendClientMessage(playerid, COLOR_ADMIN, "Player is not connected!");
  1099.                        
  1100.                 SetPlayerSkin(id, skin);
  1101.                 PlayerInfo[playerid][pSkin] = skin;
  1102.                 new msg[256];
  1103.                 format(msg, sizeof(msg), "Your skin was changed by %s.", PlayerInfo[playerid][pRPName]);
  1104.                 SendClientMessage(id, COLOR_ADMIN, msg);
  1105.         }
  1106.            
  1107.         return 1;
  1108. }
  1109.  
  1110. COMMAND:v(playerid, params[])
  1111. {
  1112.         new id;
  1113.         if (sscanf(params, "i", id))
  1114.             return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /v <vehicle id>");
  1115.            
  1116.         new Float:x, Float:y, Float:z, Float:angle;
  1117.         GetPlayerPos(playerid, x, y, z);
  1118.         GetPlayerFacingAngle(playerid, angle);
  1119.        
  1120.         AddStaticVehicle(id, x, y, z, angle, 0, 0);
  1121.            
  1122.         return 1;
  1123. }
  1124. // [ Admin Section ]