Advertisement
Guest User

Script

a guest
Feb 28th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 17.50 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <a_mysql>
  4. #include <sscanf2>
  5. #include <colors>
  6.  
  7. new RandomMSG[][] =
  8. {
  9.    "{FF0000}[BOT]S.A.M.:{FFFFFF}Please visit our forums to read the latest news!",
  10.    "{FF0000}[BOT]S.A.M.:{FFFFFF}Did you know, the owners are Brad & illuminati?",
  11.    "{FF0000}[BOT]S.A.M.:{FFFFFF}Please report if you have any questions",
  12.    "{FF0000}[BOT]S.A.M.:{FFFFFF}Please visit our forums to read the latest news!"
  13. };
  14.  
  15.  
  16. native WP_Hash(_buffer[], len, const str[]);
  17.  
  18. #define DIALOG_REGISTER 1
  19. #define DIALOG_LOGIN 2
  20.  
  21. #define MySQL_Host ""
  22. #define MySQL_Username "server_739"
  23. #define MySQL_Password ""
  24. #define MySQL_Database "server_739"
  25.  
  26. enum pInfo
  27. {
  28.     pScore,
  29.     pAdmin,
  30.     pVip,
  31.     pTrusted,
  32.     pHighest,
  33.     pMoney,
  34.     pKills,
  35.     pDeaths
  36. }
  37. new PlayerInfo[MAX_PLAYERS][pInfo];
  38.  
  39. new connection;
  40. new MySQL_Query[1800];
  41.  
  42. new PasswordAttempts[MAX_PLAYERS];
  43. new IsPlayerLoggedIn[MAX_PLAYERS char];
  44.  
  45. forward LoggedIn(playerid, const password[]);
  46. forward CheckPasswordAttempts(playerid);
  47. forward IsRegistered(playerid);
  48.  
  49. //==============================================================================
  50.  
  51. main()
  52. {
  53.     print("\n----------------------------------");
  54.     print(" Blank Gamemode by your name here");
  55.     print("----------------------------------\n");
  56. }
  57. public OnGameModeInit()
  58. {
  59.     SetTimer("SendMSG", 60000, true);
  60.     connection = mysql_connect(MySQL_Host, MySQL_Username, MySQL_Database, MySQL_Password);
  61.     if(!mysql_errno(connection)) print("MySQL Connection Success");
  62.     else print("MySQL Connection Failed");
  63.  
  64.     SetGameModeText("Blank Script");
  65.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  66.     return 1;
  67. }
  68. forward SendMSG();
  69. public SendMSG()
  70. {
  71.     new randMSG = random(sizeof(RandomMSG));
  72.     SendClientMessageToAll(-1, RandomMSG[randMSG]);
  73. }
  74.  
  75. public OnGameModeExit()
  76. {
  77.     mysql_close(connection);
  78.     return 1;
  79. }
  80.  
  81. public OnPlayerRequestClass(playerid, classid)
  82. {
  83.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  84.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  85.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  86.     return 1;
  87. }
  88.  
  89. public OnPlayerConnect(playerid)
  90. {
  91.     format(MySQL_Query, sizeof(MySQL_Query), "SELECT * FROM `Accounts` WHERE Username = '%s'", EscapeText(PlayerName(playerid)));
  92.     mysql_function_query(connection, MySQL_Query, true, "IsRegistered", "i", playerid);
  93.     return 1;
  94. }
  95.  
  96. public OnPlayerDisconnect(playerid, reason)
  97. {
  98.     if(IsPlayerLoggedIn{playerid} == 1)
  99.     {
  100.         format(MySQL_Query, sizeof(MySQL_Query), "UPDATE `Accounts` SET Score = '%i' , Admin = '%i' , Vip = '%i' , Trusted_Players = '%i' , Highest_Donator = '%i' , Money = '%i', Kills = '%i', Deaths = '%i' WHERE Username = '%s'",
  101.         PlayerInfo[playerid][pScore], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVip], PlayerInfo[playerid][pTrusted], PlayerInfo[playerid][pHighest], PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], EscapeText(PlayerName(playerid)));
  102.         mysql_function_query(connection, MySQL_Query, false, "", "");
  103.     }
  104.  
  105.     PlayerInfo[playerid][pAdmin] = 0;
  106.     PlayerInfo[playerid][pVip] = 0;
  107.     PlayerInfo[playerid][pScore] = 0;
  108.     PlayerInfo[playerid][pTrusted] = 0;
  109.     PlayerInfo[playerid][pHighest] = 0;
  110.     PlayerInfo[playerid][pMoney] = 0;
  111.     return 1;
  112. }
  113.  
  114. public OnPlayerSpawn(playerid)
  115. {
  116.     return 1;
  117. }
  118.  
  119. public OnPlayerDeath(playerid, killerid, reason)
  120. {
  121.     if(killerid != INVALID_PLAYER_ID) return 1;
  122.    
  123.     PlayerInfo[playerid][pDeaths] += 1;
  124.     PlayerInfo[killerid][pKills] += 1;
  125.     return 1;
  126. }
  127.  
  128. public OnVehicleSpawn(vehicleid)
  129. {
  130.     return 1;
  131. }
  132.  
  133. public OnVehicleDeath(vehicleid, killerid)
  134. {
  135.     return 1;
  136. }
  137.  
  138. public OnPlayerText(playerid, text[])
  139. {
  140.     return 1;
  141. }
  142.  
  143. /*public OnPlayerCommandText(playerid, cmdtext[])
  144. {
  145.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  146.     {
  147.         // Do something here
  148.         return 1;
  149.     }
  150.     return 0;
  151. }*/
  152.  
  153. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  154. {
  155.     return 1;
  156. }
  157.  
  158. public OnPlayerExitVehicle(playerid, vehicleid)
  159. {
  160.     return 1;
  161. }
  162.  
  163. public OnPlayerStateChange(playerid, newstate, oldstate)
  164. {
  165.     return 1;
  166. }
  167.  
  168. public OnPlayerEnterCheckpoint(playerid)
  169. {
  170.     return 1;
  171. }
  172.  
  173. public OnPlayerLeaveCheckpoint(playerid)
  174. {
  175.     return 1;
  176. }
  177.  
  178. public OnPlayerEnterRaceCheckpoint(playerid)
  179. {
  180.     return 1;
  181. }
  182.  
  183. public OnPlayerLeaveRaceCheckpoint(playerid)
  184. {
  185.     return 1;
  186. }
  187.  
  188. public OnRconCommand(cmd[])
  189. {
  190.     return 1;
  191. }
  192.  
  193. public OnPlayerRequestSpawn(playerid)
  194. {
  195.     return 1;
  196. }
  197.  
  198. public OnObjectMoved(objectid)
  199. {
  200.     return 1;
  201. }
  202.  
  203. public OnPlayerObjectMoved(playerid, objectid)
  204. {
  205.     return 1;
  206. }
  207.  
  208. public OnPlayerPickUpPickup(playerid, pickupid)
  209. {
  210.     return 1;
  211. }
  212.  
  213. public OnVehicleMod(playerid, vehicleid, componentid)
  214. {
  215.     return 1;
  216. }
  217.  
  218. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  219. {
  220.     return 1;
  221. }
  222.  
  223. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  224. {
  225.     return 1;
  226. }
  227.  
  228. public OnPlayerSelectedMenuRow(playerid, row)
  229. {
  230.     return 1;
  231. }
  232.  
  233. public OnPlayerExitedMenu(playerid)
  234. {
  235.     return 1;
  236. }
  237.  
  238. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  239. {
  240.     return 1;
  241. }
  242.  
  243. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  244. {
  245.     return 1;
  246. }
  247.  
  248. public OnRconLoginAttempt(ip[], password[], success)
  249. {
  250.     return 1;
  251. }
  252.  
  253. public OnPlayerUpdate(playerid)
  254. {
  255.     return 1;
  256. }
  257.  
  258. public OnPlayerStreamIn(playerid, forplayerid)
  259. {
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerStreamOut(playerid, forplayerid)
  264. {
  265.     return 1;
  266. }
  267.  
  268. public OnVehicleStreamIn(vehicleid, forplayerid)
  269. {
  270.     return 1;
  271. }
  272.  
  273. public OnVehicleStreamOut(vehicleid, forplayerid)
  274. {
  275.     return 1;
  276. }
  277.  
  278. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  279. {
  280.     if(dialogid == DIALOG_REGISTER)
  281.     {
  282.         if(!response)
  283.         {
  284.             Kick(playerid);
  285.             return 1;
  286.         }
  287.  
  288.         if(!strlen(inputtext))
  289.         {
  290.             SendClientMessage(playerid, -1, "Enter a password.");
  291.             ShowRegisterScreen(playerid);
  292.             return 1;
  293.         }
  294.  
  295.         if(strlen(inputtext) < 5)
  296.         {
  297.             SendClientMessage(playerid, -1, "Enter a password with more than 5 characters.");
  298.             ShowRegisterScreen(playerid);
  299.             return 1;
  300.         }
  301.  
  302.         if(strlen(inputtext) >= 5)
  303.         {
  304.             new IP[20], hashedpass[200];
  305.             GetPlayerIp(playerid, IP, sizeof(IP));
  306.             WP_Hash(hashedpass, sizeof(hashedpass), inputtext);
  307.  
  308.             new querystring[1800];
  309.  
  310.             strcat(querystring, "INSERT INTO `Accounts` (`ID`, `Username`, `Password`, `Admin`, `Vip, `Money`, `Kills`, `Deaths`, `Trusted_Player`, `Highest_Donator`)");
  311.             strcat(querystring, " VALUES");
  312.  
  313.             format(MySQL_Query, sizeof(MySQL_Query), "%s (NULL, '%s', '%s', '0', '0', '0', '0', '0', '0', '0')", querystring, EscapeText(PlayerName(playerid)), EscapeText(hashedpass));
  314.             mysql_function_query(connection, MySQL_Query, false, "", "");
  315.         }
  316.         IsPlayerLoggedIn{playerid} = 1;
  317.         return 1;
  318.     }
  319.  
  320.     if(dialogid == DIALOG_LOGIN)
  321.     {
  322.         if(!response)
  323.         {
  324.             Kick(playerid);
  325.             return 1;
  326.         }
  327.  
  328.         if(!strlen(inputtext))
  329.         {
  330.             SendClientMessage(playerid, -1, "Enter a password.");
  331.             ShowLoginScreen(playerid);
  332.         }
  333.  
  334.         if(strlen(inputtext) < 5)
  335.         {
  336.             SendClientMessage(playerid, -1, "Enter a password with more than 5 char.");
  337.             ShowLoginScreen(playerid);
  338.         }
  339.  
  340.         if(strlen(inputtext) >= 5)
  341.         {
  342.             format(MySQL_Query, sizeof(MySQL_Query), "SELECT * FROM `Accounts` WHERE Username='%s'", EscapeText(PlayerName(playerid)));
  343.             mysql_function_query(connection, MySQL_Query, true, "LoggedIn", "is", playerid, inputtext);
  344.         }
  345.         return 1;
  346.     }
  347.     return 1;
  348. }
  349.  
  350. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  351. {
  352.     return 1;
  353. }
  354.  
  355. public LoggedIn(playerid, const password[])
  356. {
  357.     new ppassword[500];
  358.     new hashedpass[500];
  359.  
  360.     WP_Hash(hashedpass, sizeof(hashedpass), password);
  361.     cache_get_field_content(0, "Password", ppassword, connection);
  362.  
  363.     if(!strcmp(hashedpass, ppassword))
  364.     {
  365.         if(IsPlayerLoggedIn{playerid} != 1)
  366.         {
  367.             new tempfetch[500];
  368.             cache_get_field_content(0, "Score", tempfetch, connection),             PlayerInfo[playerid][pScore] = strval(tempfetch);
  369.             cache_get_field_content(0, "Admin", tempfetch, connection),             PlayerInfo[playerid][pAdmin] = strval(tempfetch);
  370.             cache_get_field_content(0, "Vip", tempfetch, connection),               PlayerInfo[playerid][pVip] = strval(tempfetch);
  371.             cache_get_field_content(0, "Trusted_Player", tempfetch, connection),    PlayerInfo[playerid][pTrusted] = strval(tempfetch);
  372.             cache_get_field_content(0, "Highest_Donator", tempfetch, connection),   PlayerInfo[playerid][pHighest] = strval(tempfetch);
  373.             cache_get_field_content(0, "Money", tempfetch, connection),             PlayerInfo[playerid][pMoney] = strval(tempfetch);
  374.             cache_get_field_content(0, "Kills", tempfetch, connection),             PlayerInfo[playerid][pKills] = strval(tempfetch);
  375.             cache_get_field_content(0, "Deaths", tempfetch, connection),            PlayerInfo[playerid][pDeaths] = strval(tempfetch);
  376.  
  377.             IsPlayerLoggedIn{playerid} = 1;
  378.  
  379.             SendClientMessage(playerid, -1, "{8EC7DC}[INFO] {FFFFFF}Your statistics have been restored.");
  380.             return 1;
  381.         }
  382.     }
  383.     else
  384.     {
  385.         CheckPasswordAttempts(playerid);
  386.         ShowLoginScreen(playerid);
  387.     }
  388.     return 1;
  389. }
  390.  
  391. public CheckPasswordAttempts(playerid)
  392. {
  393.     if(PasswordAttempts[playerid] == 0)
  394.     {
  395.         SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [1/3]");
  396.         PasswordAttempts[playerid] ++;
  397.         return 1;
  398.     }
  399.  
  400.     if(PasswordAttempts[playerid] == 1)
  401.     {
  402.         SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [2/3]");
  403.         PasswordAttempts[playerid] ++;
  404.         return 1;
  405.     }
  406.  
  407.     if(PasswordAttempts[playerid] == 2)
  408.     {
  409.         new string[128];
  410.         SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [3/3]");
  411.  
  412.         format(string,sizeof(string),"{208DD6}[SERVER] {FFFFFF}%s[%d] has been kicked from the server. (Max password attempts)",PlayerName(playerid),playerid);
  413.         SendClientMessageToAll(COLOR_WHITE,string);
  414.  
  415.         Kick(playerid);
  416.         return 1;
  417.     }
  418.     return 1;
  419. }
  420.  
  421. public IsRegistered(playerid)
  422. {
  423.     new rows, fields;
  424.  
  425.     cache_get_data(rows, fields, connection);
  426.  
  427.     if(rows)
  428.     {
  429.         ShowLoginScreen(playerid);
  430.     }
  431.     else
  432.     {
  433.         ShowRegisterScreen(playerid);
  434.     }
  435.     return 1;
  436. }
  437.  
  438. public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
  439. {
  440.     printf("Error ID: %i", errorid);
  441.     printf("Error: %s", error);
  442.     printf("callback: %s", callback);
  443.     printf("query: %s", query);
  444.     return 1;
  445. }
  446.  
  447. stock EscapeText(text[])
  448. {
  449.     new EscapedData[200];
  450.     mysql_real_escape_string(text, EscapedData, connection);
  451.     return EscapedData;
  452. }
  453.  
  454. stock ShowLoginScreen(playerid)
  455. {
  456.     new string[128];
  457.     format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
  458.     ShowPlayerDialog(playerid,DIALOG_LOGIN,3,"{EDDC57}Login required",string,"Login","Cancel");
  459. }
  460.  
  461. stock ShowRegisterScreen(playerid)
  462. {
  463.     new string[128];
  464.     format(string, sizeof(string), "This server requires you to register an account before playing\n\nUsername: %s\n\nEnter your desired password below then click ok",PlayerName(playerid));
  465.     ShowPlayerDialog(playerid,DIALOG_REGISTER,3,"{EDDC57}Registration required",string,"Register","Cancel");
  466. }
  467.  
  468. stock PlayerName(playerid)
  469. {
  470.     new name[21];
  471.     GetPlayerName(playerid, name, sizeof(name));
  472.     return name;
  473. }
  474.  
  475.  
  476. CMD:setlevel(playerid,params[])
  477. {
  478.     new string[128], ID, level;
  479.  
  480.     if(PlayerInfo[playerid][pAdmin] < 3) // change this to owner level
  481.         return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You don't have access to this command.");
  482.  
  483.     if(sscanf(params,"ii",ID,level))
  484.         return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}USAGE: /setlevel [playerid] [Level]");
  485.  
  486.     if(!IsPlayerConnected(ID))
  487.         return SendClientMessage(playerid, COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}The requested playerid is not connected to the server.");
  488.  
  489.     if(PlayerInfo[playerid][pAdmin] <= PlayerInfo[ID][pAdmin])
  490.         return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF} This has no effect on the current playerid.");
  491.  
  492.     if(PlayerInfo[ID][pAdmin] == level)
  493.     {
  494.         format(string,sizeof(string),"{B30000}[ERROR] {FFFFFF}%s[%d] is already at the Administrator level: %d",PlayerName(ID),ID,level);
  495.         SendClientMessage(playerid,COLOR_WHITE,string);
  496.         return 1;
  497.     }
  498.  
  499.     if(playerid == ID)
  500.         return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You cannot set your own Administrator level.");
  501.  
  502.     if(PlayerInfo[ID][pAdmin] < level)
  503.     {
  504.         format(string, sizeof(string), "{46A4E3}[ADMIN] {FFFFFF}%s[%d] has promoted %s[%d] to level %d.",PlayerName(playerid),playerid,PlayerName(ID),ID,level);
  505.         SendClientMessageToAll(COLOR_WHITE,string);
  506.     }
  507.  
  508.     else if(PlayerInfo[ID][pAdmin] > level)
  509.     {
  510.         format(string, sizeof(string), "{46A4E3}[ADMIN] {FFFFFF}%s[%d] has demoted %s[%d] to level %d.",PlayerName(playerid),playerid,PlayerName(ID),ID,level);
  511.         SendClientMessageToAll(COLOR_WHITE,string);
  512.     }
  513.  
  514.     PlayerInfo[ID][pAdmin] = level;
  515.  
  516.     return 1;
  517. }
  518.  
  519. CMD:setscore(playerid,params[])
  520. {
  521.     new string[128], ID, score;
  522.  
  523.     if(PlayerInfo[playerid][pAdmin] < 3) // change to owner rank
  524.         return  SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You don't have access to this command.");
  525.  
  526.     if(sscanf(params,"ii",ID,score))
  527.         return SendClientMessage(playerid, COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}The requested playerid is not connected to the server.");
  528.  
  529.     if(!IsPlayerConnected(ID))
  530.         return SendClientMessage(playerid, COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}The requested playerid is not connected to the server.");
  531.  
  532.     if(PlayerInfo[playerid][pAdmin] < PlayerInfo[ID][pAdmin])
  533.          return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF} This has no effect on the current playerid.");
  534.  
  535.     format(string,sizeof(string),"{46A4E3}[ADMIN] {FFFFFF}%s[%d] has set %s[%d]'s score to %d.",PlayerName(playerid),playerid,PlayerName(ID),ID,score);
  536.     SendClientMessageToAll(COLOR_WHITE,string);
  537.  
  538.     SetPlayerScore(ID, score);
  539.     PlayerInfo[ID][pScore] = score;
  540.     return 1;
  541. }
  542.  
  543. CMD:kick(playerid, params[])
  544. {
  545.     new id, sendername[MAX_PLAYER_NAME], string[128], reason[128];
  546.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, -1,"  you are not authorized to use this command");
  547.     if(sscanf(params,"us[128]",id, reason)) return SendClientMessage(playerid, -1,"USAGE: /kick [playerid/partofname] [reason]");
  548.     if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"Player is not connected");
  549.     else
  550.     {
  551.         GetPlayerName(playerid, sendername, sizeof(sendername));
  552.         format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", id, sendername, reason);
  553.         SendClientMessageToAll(0xF00505FF ,string);
  554.         Kick(id);
  555.     }
  556.     return 1;
  557. }
  558.  
  559. CMD:ban(playerid, params[])
  560. {
  561.     new id, sendername[MAX_PLAYER_NAME], string[128], reason[128];
  562.     if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, -1,"  you are not authorized to use this command");
  563.     if(sscanf(params,"us[128]",id, reason)) return SendClientMessage(playerid, -1,"USAGE: /ban [playerid/partofname] [reason]");
  564.     if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"Player is not connected");
  565.     else
  566.     {
  567.         GetPlayerName(playerid, sendername, sizeof(sendername));
  568.         format(string, sizeof(string), "AdmCmd: %s was BANNED! by %s, reason: %s", id, sendername, reason);
  569.         SendClientMessageToAll(0xF00505FF ,string);
  570.         Ban(id);
  571.     }
  572.     return 1;
  573. }
  574.  
  575. CMD:forcekill(playerid, params[]) //using ZCMD this is how your command will start off looking like.
  576. {
  577.     new otherplayerid;
  578.     if(PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage(playerid, -1,"  you are not authorized to use this command");
  579.     if(sscanf(params, "u", otherplayerid)) return SendClientMessage(playerid, COLOR_RED, "Use /forcekill [playerid/name]");
  580.     else if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
  581.     else
  582.     {
  583.    
  584.         SendClientMessage(otherplayerid,COLOR_RED,"You have been killed by an Administrator");
  585.         SetPlayerHealth(otherplayerid,0);
  586.     }
  587.     return 1;
  588. }
  589.  
  590. CMD:pay(playerid,params[])
  591. {
  592.     new
  593.         ID,
  594.         amount,
  595.         name[MAX_PLAYERS],
  596.         string7[200],
  597.         name2[MAX_PLAYERS],
  598.         string8[200];
  599.     if(sscanf(params, "ui", ID,amount)) return SendClientMessage(playerid, -1, "Usage: /pay [playerid] [amount]");
  600.     if(amount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, -1, "[ERROR]: You do not have enough money to pay that player!");
  601.     if(amount <= 0) return SendClientMessage(playerid, -1, "[ERROR]: You cannot pay less than $1!");
  602.     if(playerid == ID) return SendClientMessage(playerid, -1, "[ERROR]: You can't pay yourself!");
  603.     GetPlayerName(ID, name2, sizeof(name2));
  604.     format(string8, sizeof(string8),"You have paid %s $%i", name2, amount);
  605.     SendClientMessage(playerid, COLOR_RED, string8);
  606.     GetPlayerName(playerid, name, sizeof(name));
  607.     format(string7, sizeof(string7), "%s(%d) Has paid you: $%i", name, playerid, amount);
  608.     SendClientMessage(ID, COLOR_RED, string7);
  609.     GivePlayerMoney(ID, amount);
  610.     GivePlayerMoney(playerid, -amount);
  611.     return 1;
  612. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement