29.09.2018, 09:55
Hey guys, with my previous post, ive only found that im not getting money because of anticheat, and the server is based on mysql but the filterscript of the job isnt. so i would really appreciate if anyone can define my /givemoney into the filterscript so that i can make it work on server to get money after the job is done. ill leave the scripts below. i really really appreciate the help and will also give +rep . Thanks.
My /givemoney command
Stock give playercash
Finally the filterscript i want to get working situation
My /givemoney command
Код HTML:
CMD:givemoney(playerid, params[]) { new targetid, amount; if(PlayerInfo[playerid][pAdmin] < 7) { return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); } if(sscanf(params, "ui", targetid, amount)) { return SendClientMessage(playerid, COLOR_SYNTAX, "USAGE: /givemoney [playerid] [amount]"); } if(!IsPlayerConnected(targetid)) { return SendClientMessage(playerid, COLOR_GREY, "The player specified is disconnected."); } if(!PlayerInfo[targetid][pLogged]) { return SendClientMessage(playerid, COLOR_GREY, "That player hasn't logged in yet."); } GivePlayerCash(targetid, amount); SendAdminMessage(COLOR_LIGHTRED, "AdmCmd: %s has given %s to %s.", GetPlayerRPName(playerid), FormatNumber(amount), GetPlayerRPName(targetid)); Log_Write("log_givemoney", "%s (uid: %i) has used /givemoney to give $%i to %s (uid: %i).", GetPlayerNameEx(playerid), PlayerInfo[playerid][pID], amount, GetPlayerNameEx(targetid), PlayerInfo[targetid][pID]); return 1; }
Код HTML:
forward GivePlayerCash(playerid, amount);
public GivePlayerCash(playerid, amount)
{
if(PlayerInfo[playerid][pLogged])
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] + amount;
if(amount < 0)
{
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET money_spent = money_spent + %i WHERE uid = %i", -amount, PlayerInfo[playerid][pID]);
mysql_tquery(connectionID, queryBuffer);
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "SELECT uid FROM users WHERE uid = %i AND money_spent >= 500000", PlayerInfo[playerid][pID]);
mysql_tquery(connectionID, queryBuffer, "OnPlayerCheckMoney", "is", playerid, "I'm rich!");
}
else if(amount > 0)
{
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET money_earned = money_earned + %i WHERE uid = %i", amount, PlayerInfo[playerid][pID]);
mysql_tquery(connectionID, queryBuffer);
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "SELECT uid FROM users WHERE uid = %i AND money_earned >= 500000", PlayerInfo[playerid][pID]);
mysql_tquery(connectionID, queryBuffer, "OnPlayerCheckMoney", "is", playerid, "High roller");
}
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET cash = cash + %i WHERE uid = %i", amount, PlayerInfo[playerid][pID]);
mysql_tquery(connectionID, queryBuffer);
}
return 1;
}
Код HTML:
#include <a_samp> #include <zcmd> #define FILTERSCRIPT #define COLOR_GREEN 0x33AA33FF #define COLOR_YELLOW 0xFFFF00FF #define COLOR_RED 0xFF0606FF public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Trucker Job - Created by Cena44(Timon) "); print("--------------------------------------\n"); CreateVehicle(414, 2512.1653, -2117.0974, 13.4788, 0.0000, 27, 78, 3000); CreateVehicle(414, 2506.7500, -2116.7947, 13.4788, 0.0000, 41, 42, 3000); CreateVehicle(414, 2482.2327, -2116.6165, 13.4788, 0.0000, 48, 72, 3000); CreateVehicle(456, 2463.3999, -2116.1843, 13.5200, 0.0000, 46, 89, 3000); CreateVehicle(456, 2457.8191, -2115.6475, 13.5200, 0.0000, 78, 27, 3000); CreateVehicle(456, 2488.4919, -2116.3032, 13.5200, 0.0000, 24, 78, 3000); CreatePickup(1239, 1, 2485.4292,-2120.2351,13.5469, 0); // Boxer Job Create3DTextLabel("Trucks Depot\n{FFFF00}/loadtruck to get load the truck", COLOR_RED, 2485.4292,-2120.2351,13.5469, 15, 0, 1); CreatePickup(1239, 1, 2460.3623,-2119.8494,13.5530, 0); // Boxer Job Create3DTextLabel("Trucks Depot\n{FFFF00}/loadtruck to get load the truck", COLOR_RED, 2460.3623,-2120.2351,13.5469, 15, 0, 1); CreatePickup(1239, 1, 2509.6421,-2120.6365,13.5469, 0); // Boxer Job Create3DTextLabel("Trucks Depot\n{FFFF00}/loadtruck to get load the truck", COLOR_RED, 2509.6421,-2120.2351,13.5469, 15, 0, 1); return 1; } CMD:loadtruck(playerid, params[]) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a truck from the depot."); if(!IsPlayerInRangeOfPoint(playerid, 7.5, 2485.4292,-2120.2351,13.5469) && !IsPlayerInRangeOfPoint(playerid, 7.5, 2460.3623,-2119.8494,13.5530) && !IsPlayerInRangeOfPoint(playerid, 7.5, 2509.6421,-2120.6365,13.5469)) { SendClientMessage(playerid, COLOR_RED, "You are not near the loading place."); return 1; } { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Welcome to the factory, what would you like to deliver?", "{00B000}Drinks and Food($500) \n{00B000}Clothing($1000) \n{A70000}Drugs($1500) \n{A70000}Illegal Fire Arms($2000)", "Load Truck", "Cancel"); return 1; } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(response)// They pressed the first button. { switch(dialogid) { case 1:// Our dialog! { switch(listitem)// Checking which listitem was selected { case 0:// The first item listed { if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy this products."); GivePlayerMoney(playerid, -500); SetPlayerCheckpoint(playerid, 2121.4949,-1781.8108,13.5618, 5.0); SendClientMessage(playerid, COLOR_YELLOW, "You have loaded some Food and drinks crates, deliver them to the Well Stacked Pizza Co. to get your pay. (Checkpoint)"); } case 1: // The second item listed { if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy this products."); GivePlayerMoney(playerid, -1000); SetPlayerCheckpoint(playerid, 2247.8418,-1661.3953,15.5455, 5.0); SendClientMessage(playerid, COLOR_YELLOW, "You have loaded some Clothes Boxes, deliver them to Binco to get your pay. (Checkpoint)"); } case 2: // The third item listed { if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy this products."); GivePlayerMoney(playerid, -1500); SetPlayerCheckpoint(playerid, 2517.2693,-1274.5581,34.9548, 5.0); SendClientMessage(playerid, COLOR_YELLOW, "You have loaded some drug packages, deliver them to the Drug factory to get your pay. (Checkpoint)"); } case 3: // The fourth item listed { if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy this products."); GivePlayerMoney(playerid, -2000); SetPlayerCheckpoint(playerid, 1362.9902,-1279.9124,13.6332, 5.0); SendClientMessage(playerid, COLOR_YELLOW, "You have loaded some weapon crates, deliver them to the Ammu-Nation to get your pay. (Checkpoint)"); } } } } } return 1; } public OnPlayerEnterCheckpoint(playerid) { if(!IsPlayerInVehicle(playerid, 2) && !IsPlayerInVehicle(playerid, 3) && !IsPlayerInVehicle(playerid, 4) && !IsPlayerInVehicle(playerid, 1) && !IsPlayerInVehicle(playerid, 5) && !IsPlayerInVehicle(playerid, 6)) { SendClientMessage(playerid,COLOR_RED,"You are not in the delivery truck."); return 1; } if(IsPlayerInRangeOfPoint(playerid,5,2121.4949,-1781.8108,13.5618)) // Food and Drinks { SendClientMessage(playerid, COLOR_GREEN, "You have delivered the products and got payed $1000, good job."); GivePlayerMoney(playerid, 1000); DisablePlayerCheckpoint(playerid); } if(IsPlayerInRangeOfPoint(playerid,5,2247.8418,-1661.3953,15.5455)) // Clothing { SendClientMessage(playerid, COLOR_GREEN, "You have delivered the products and got payed $2000, good job."); GivePlayerMoney(playerid, 2000); DisablePlayerCheckpoint(playerid); } if(IsPlayerInRangeOfPoint(playerid,5,2517.2693,-1274.5581,34.9548)) // Drugs { SendClientMessage(playerid, COLOR_GREEN, "You have delivered the products and got payed $3000, good job."); GivePlayerMoney(playerid, 3000); DisablePlayerCheckpoint(playerid); } if(IsPlayerInRangeOfPoint(playerid,5,1362.9902,-1279.9124,13.6332)) // Illegal Fire Arms { SendClientMessage(playerid, COLOR_GREEN, "You have delivered the products and got payed $4000 and a special weapon with some bullets, good job."); GivePlayerMoney(playerid, 4000); GivePlayerWeapon(playerid, 24, 50); DisablePlayerCheckpoint(playerid); } return 1; }