Pinki95
-
Posts
130 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
News
Documentation
Posts posted by Pinki95
-
-
Vreau ca in loc sa scri /bank sa fie un pickup:
[pawn]COMMAND:bank(playerid, params[])
{
// Setup local variables
new file[100], Name[24];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/bank", params);
// Get the playername
format(Name, sizeof(Name), APlayerData[playerid][PlayerName]);
// Construct the complete filename for this player's bank-account
format(file, sizeof(file), BankFile, Name);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player doesn't have a bank account
if (!fexist(file))
{
// Ask for a password to setup his bank account
ShowPlayerDialog(playerid, DialogBankPasswordRegister, DIALOG_STYLE_INPUT, "Enter password", "Please enter a password to register your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else // The player has a bank account
{
// If the player hasn't logged in to his bank account yet
if (APlayerData[playerid][bankLoggedIn] == false)
{
// Ask for the password to login to his bank account
ShowPlayerDialog(playerid, DialogBankPasswordLogin, DIALOG_STYLE_INPUT, "Enter password", "Please enter your password to login to your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else // The player has logged in to his bank account already
{
// Show the main bank menu dialog
ShowBankMenu(playerid);
}
}
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}[/pawn]
-
Am o problema cu banii daca vreau sa ii depozitez imi scade si imi cresc la loc banii, iar daca vreau sa ii retrag imi cresc si imi scad la loc banii(am server PPC_Trucking) Cum sa rezolv asta?
-
ma puteti ajuta sa rezolv asta:
[pawn]#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>
#include <sscanf2>
#include <foreach>
#define MAX_ATM 100
#define ATM_FILE_NAME "DATM.txt"
#define MAX_DISTANCE_TO_PROP 1.5
//colours
#define COLOR_YELLOW 0xD8D8D8FF
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_FADE 0xC8C8C8C8
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_DARKRED 0x8B0000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_PINK 0xDC00DDAA
#define COLOR_BLUE 0x0259EAAA
#define COLOR_GREEN 0x00A800AA
#define COLOR_ORANGE 0xFF8000AA
#define COLOR_CYAN 0xFF8080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKBLUE 0x0000A0AA
#define COLOR_BLACK 0x000000AA
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_BROWN 0x804000AA
#define COLOR_BLACK2 0x000000ff
#define ATM_USER_FILE "ATMs/ATMUsers/%s.ini"
//atm system crap
new ATMObject[MAX_ATM];
new Text3D:ATMLabel[MAX_ATM];
new Object[MAX_PLAYERS];
new oModel[MAX_PLAYERS];
new ATMi,ATMm;
enum ATMInfo
{
Float:ATMx,
Float:ATMy,
Float:ATMz,
ATMInt,
ATMvw,
ATMMoney
}
new abInfo[MAX_ATM][ATMInfo];
enum pInfo
{
pBank
}
new PlayerInfo[MAX_PLAYERS][pInfo];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
//bank enter
ServerInfo();
CreatePickup(1318, 1, 1465.2404,-1010.2532,26.8438, -1);
Create3DTextLabel("/enter to enter the bank.", 0x008080FF, 1465.2404,-1010.2532,26.8438, 40.0, 0, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], sfile[256];
GetPlayerName(playerid, name, sizeof(name));
format(sfile, sizeof(sfile), ATM_USER_FILE, name);
dini_IntSet(sfile,"Bank",PlayerInfo[playerid][pBank]);
if (!dini_Exists(sfile)) {
dini_Create(sfile);
dini_IntSet(sfile, "Bank",PlayerInfo[playerid][pBank] = 5000);
PlayerInfo[playerid][pBank] = 5000;
}
if(fexist(sfile)) {
PlayerInfo[playerid][pBank] = dini_Int(sfile, "Bank");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], sfile[256];
GetPlayerName(playerid, name, sizeof(name));
format(sfile, sizeof(sfile), ATM_USER_FILE, name);
dini_IntSet(sfile,"Bank",PlayerInfo[playerid][pBank]);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
AddATM(ATMid, Float:ATMxx, Float:ATMyy, Float:ATMzz, Float:ATMrxx, Float:ATMryy, Float:ATMrzz, ATMMoneyy, ATMIntt, ATMvww)
{
new ATM[256];
format(ATM, sizeof(ATM), "ATMs/ATMid%d",ATMid);
if(!dini_Exists(ATM))
{
dini_Create(ATM);
abInfo[ATMid][ATMMoney] = ATMMoneyy;
dini_IntSet(ATM, "Money", ATMMoneyy);
abInfo[ATMid][ATMInt] = ATMIntt;
dini_IntSet(ATM, "Interior", ATMIntt);
dini_IntSet(ATM, "Virtualworld", ATMvww);
abInfo[ATMid][ATMvw] = ATMvww;
abInfo[ATMid][ATMx] = ATMxx;
abInfo[ATMid][ATMy] = ATMyy;
abInfo[ATMid][ATMz] = ATMzz;
dini_FloatSet(ATM, "aX", ATMxx);
dini_FloatSet(ATM, "aY", ATMyy);
dini_FloatSet(ATM, "aZ", ATMzz);
dini_FloatSet(ATM, "rX", ATMrxx);
dini_FloatSet(ATM, "rY", ATMryy);
dini_FloatSet(ATM, "rZ", ATMrzz);
print("-");
print("--------------ATM Created--------------");
}
else
{
abInfo[ATMid][ATMMoney] = dini_Int(ATM, "Money");
abInfo[ATMid][ATMInt] = dini_Int(ATM, "Interior");
abInfo[ATMid][ATMx] = dini_Float(ATM, "aX");
abInfo[ATMid][ATMy] = dini_Float(ATM, "aY");
abInfo[ATMid][ATMz] = dini_Float(ATM, "aZ");
abInfo[ATMid][ATMvw] = dini_Int(ATM, "Virtualworld");
}
ATMObject[ATMid] = CreateObject(2942,ATMxx, ATMyy, ATMzz,ATMrxx,ATMryy,ATMrzz,0);//bought
new string[256];
format(string, sizeof(string), "ATM type /atmwithdraw and /atmbalance.\nMoney left $%d",abInfo[ATMid][ATMMoney]);
ATMLabel[ATMid] = Create3DTextLabel(string, 0x008080FF, ATMxx,ATMyy,ATMzz, 10.0, 0, 1);
}
//commands
COMMAND:enter(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,1465.2404,-1010.2532,26.8438))
{
SetPlayerPos(playerid, 2315.952880,-1.618174,26.742187);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 1);
SendClientMessage(playerid, COLOR_ORANGE, "Welcome to the bank, Go up to the desk and use /deposit, /withdraw and /balance.");
}
return 1;
}
COMMAND:exit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,2315.952880,-1.618174,26.742187))
{
SetPlayerPos(playerid, 1464.6573,-1012.9962,26.8438);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
return 1;
}
COMMAND:balance(playerid, params[])
{
new i;
i = GetATMID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
{
new string[256];
format(string, sizeof(string), "There is %d in your bank account.", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_ORANGE, string);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 3.0,abInfo[ATMx],abInfo[ATMy],abInfo[ATMz]))
{
new string[256];
format(string, sizeof(string), "There is %d in your bank account.", PlayerInfo[playerid][pBank]);
SendClientMessage(playerid, COLOR_ORANGE, string);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}
COMMAND:deposit(playerid, params[])
{
new amount;
if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
{
if(!sscanf(params, "i", amount))
{
if(amount > 0 && amount < 100000000)
{
if(GetPlayerMoney(playerid) >= amount)
{
PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]+amount;
GivePlayerMoney(playerid,-amount);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED,"You are not carrying this much money.");
}
else return SendClientMessage(playerid,COLOR_RED,"Invalid amount.");
}
else return SendClientMessage(playerid,COLOR_RED,"USAGE: /deposit [amount]");
}
else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}
COMMAND:withdraw(playerid, params[])
{
new amount;
if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
{
if(!sscanf(params, "i", amount))
{
if(amount > 0 && amount < 100000000)
{
if(PlayerInfo[playerid][pBank] >= amount)
{
PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-amount;
GivePlayerMoney(playerid,amount);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED,"You don't have this much in your account.");
}
else return SendClientMessage(playerid,COLOR_RED,"Invalid amount.");
}
else return SendClientMessage(playerid,COLOR_RED,"USAGE: /withdraw [amount]");
}
else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}
COMMAND:addatm(playerid, params[])
{
new hCost;
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "i", hCost))
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel[playerid] = 2942;
ATMm = hCost;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object[playerid] = CreateObject(2942, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
EditObject(playerid, Object[playerid]);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "USAGE: /addatm [amount of money]");
}
else return SendClientMessage(playerid, COLOR_RED, "You do not have the rights to use this command.");
}
COMMAND:setatmcash(playerid, params[])
{
new amount;
new atid;
new Biz[128];
new string[256];
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "ii", atid, amount))
{
format(Biz, sizeof(Biz), "ATMs/ATMid%d",atid);
abInfo[atid][ATMMoney] = amount;
dini_IntSet(Biz, "Money", abInfo[atid][ATMMoney]);
Delete3DTextLabel(ATMLabel[atid]);
format(string, sizeof(string), "ATM type /atmwithdraw and /atmbalance.\nMoney left $%d",abInfo[atid][ATMMoney]);
ATMLabel[atid] = Create3DTextLabel(string, 0x008080FF, abInfo[atid][ATMx],abInfo[atid][ATMy],abInfo[atid][ATMz], 10.0, 0, 1);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED,"USAGE: /setatmcash [atmid] [amount]");
}
else return SendClientMessage(playerid,COLOR_RED,"You can not use this command!");
}
COMMAND:getatmid(playerid, params[])
{
new string[256];
new i;
i = GetATMID(playerid);
if(IsPlayerAdmin(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,abInfo[ATMx],abInfo[ATMy],abInfo[ATMz]))
{
format(string, sizeof(string), "ATM ID %d",i);
SendClientMessage(playerid,COLOR_ORANGE,string);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED,"You are not around any cash machines.");
}
else return SendClientMessage(playerid,COLOR_RED,"You can not use this command!");
}
COMMAND:atmwithdraw(playerid, params[])
{
new amount;
new Biz[128];
new string[256];
new i;
i = GetATMID(playerid);
if(!sscanf(params, "i", amount))
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,abInfo[ATMx],abInfo[ATMy],abInfo[ATMz]))
{
if(amount <= abInfo[ATMMoney] && amount > 0)
{
if(amount <= PlayerInfo[playerid][pBank] && amount > 0)
{
format(Biz, sizeof[/pawn]
-
As avea nevoie de un filterscript cu in care la un pickup sa fie urmatoarele comenzi /balance, /withdraw si /deposit ma puteti ajuta?
-
daca scot includele asta(aici este si antihackul):
[pawn]// Forward the function needed to update the speedometer (used by a timer)
forward Speedometer_Update(playerid);
forward RefuelVehicle(playerid);
// This function sets up the speedometer for the given player
Speedometer_Setup(playerid)
{
// Setup the speedometer for the player
APlayerData[playerid][speedometerText] = TextDrawCreate(500.0, 395.0, " ");
APlayerData[playerid][FuelGauge] = TextDrawCreate(500.0, 410.0, " ");
// Enable the TextDraw for this player
TextDrawShowForPlayer(playerid, APlayerData[playerid][speedometerText]);
TextDrawShowForPlayer(playerid, APlayerData[playerid][FuelGauge]);
// Start the speedometer timer
APlayerData[playerid][speedometerTimer] = SetTimerEx("Speedometer_Update", 500, true, "i", playerid);
return 1;
}
// This function cleans up the speedometer for the given player
Speedometer_Cleanup(playerid)
{
// Destroy the speedometer textdraw
TextDrawDestroy(APlayerData[playerid][speedometerText]);
TextDrawDestroy(APlayerData[playerid][FuelGauge]);
// Kill the speedometer timer
KillTimer(APlayerData[playerid][speedometerTimer]);
// Set player speed to 0
APlayerData[playerid][PlayerSpeed] = 0;
return 1;
}
// This function gets called by a timer which runs every 500ms to display and update the speedometer
public Speedometer_Update(playerid)
{
// Setup local variables
new vehicleid, Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, speed_string[50], final_speed_int, Float:vehiclehealth;
new FuelString[50], FuelStatus[20];
new Msg[128], Name[24];
// Get the ID of the player's vehicle
vehicleid = GetPlayerVehicleID(playerid);
//******************************************************************************************************************************
// Anti-hack stuff
//******************************************************************************************************************************
AntiHack(playerid);
//******************************************************************************************************************************
// End of anti-hack stuff
//******************************************************************************************************************************
// Check and toggle spectate-mode when needed (when target player entered or exited his vehicle)
if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
{
// Get the target player's ID and name
new OtherPlayer = APlayerData[playerid][spectateID];
GetPlayerName(OtherPlayer, Name, sizeof(Name));
// Use the same worldid and interiorid as the OtherPlayer
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(OtherPlayer));
SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
// Check if the player is spectating a player
if (APlayerData[playerid][spectateType] == ADMIN_SPEC_TYPE_PLAYER)
{
// Check if the target player has entered a vehicle
if (GetPlayerVehicleSeat(OtherPlayer) != -1)
{
// Change spectate mode to vehicle
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(OtherPlayer));
APlayerData[playerid][spectateID] = OtherPlayer;
APlayerData[playerid][spectateVehicle] = GetPlayerVehicleID(OtherPlayer);
APlayerData[playerid][spectateType] = ADMIN_SPEC_TYPE_VEHICLE;
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} has entered a vehicle, changing spectate mode to match", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else // The player is spectating a vehicle
{
// Check if the target player has exited a vehicle
if (GetPlayerVehicleSeat(OtherPlayer) == -1)
{
// Change spectate mode to player
PlayerSpectatePlayer(playerid, OtherPlayer);
SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
APlayerData[playerid][spectateID] = OtherPlayer;
APlayerData[playerid][spectateType] = ADMIN_SPEC_TYPE_PLAYER;
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} has exited a vehicle, changing spectate mode to match", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
}
// When the player got a wanted level and a police player warned him to stop, a timer is started and a variable is set to "true"
// Check if this variable has been set
if (APlayerData[playerid][PoliceWarnedMe] == true)
{
// Check if the player has no wanted level anymore (after finishing a overloaded mission, player got fined, ...)
if (GetPlayerWantedLevel(playerid) == 0)
{
APlayerData[playerid][PoliceCanJailMe] = false; // Clear the variable
APlayerData[playerid][PoliceWarnedMe] = false; // Clear the variable
APlayerData[playerid][Value_PoliceCanJailMe] = 0; // Clear the remaining time for the timer
KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]); // Kill the timer
}
}
// If the player is inside a vehicle
if(vehicleid != 0)
{
// Get the vehicles velocity
GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
// Calculate the speed (in kph)
final_speed = floatsqroot(((speed_x * speed_x) + (speed_y * speed_y)) + (speed_z * speed_z)) * 158.179;
// Convert the float value to an int value
final_speed_int = floatround(final_speed, floatround_round);
// Also save the speed for the player
APlayerData[playerid][PlayerSpeed] = final_speed_int;
// Setup the string to display for the player and display it
format(speed_string, 50, TXT_SpeedometerSpeed, final_speed_int);
TextDrawSetString(APlayerData[playerid][speedometerText], speed_string);
// Add the speed to the stats (this will be the meters driven in total)
APlayerData[playerid][statsMetersDriven] = APlayerData[playerid][statsMetersDriven] + (final_speed / 7.2);
// Also display the vehicle's health through the player-health bar
GetVehicleHealth(vehicleid, vehiclehealth);
SetPlayerHealth(playerid, vehiclehealth / 10.0);
// Check if the speed is above 10kph and the fuel of the vehicle isn't empty yet
if ((final_speed_int > 10) && (AVehicleData[vehicleid][Fuel] > 0))
AVehicleData[vehicleid][Fuel] = AVehicleData[vehicleid][Fuel] - 1; // Decrease the fuel for this vehicle every time the timer is run
// Construct the fuelgauge
if ((AVehicleData[vehicleid][Fuel] > 0) && (AVehicleData[vehicleid][Fuel] < 100000))
format(FuelStatus, 20, "~g~%s~r~%s", "I", "IIIIIIIII"); // Fuel is between 0% and 10% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 1)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 2)))
format(FuelStatus, 20, "~g~%s~r~%s", "II", "IIIIIIII"); // Fuel is between 10% and 20% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 2)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 3)))
format(FuelStatus, 20, "~g~%s~r~%s", "III", "IIIIIII"); // Fuel is between 20% and 30% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 3)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 4)))
format(FuelStatus, 20, "~g~%s~r~%s", "IIII", "IIIIII"); // Fuel is between 30% and 40% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 4)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 5)))
format(FuelStatus, 20, "~g~%s~r~%s", "IIIII", "IIIII"); // Fuel is between 40% and 50% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 5)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 6)))
format(FuelStatus, 20, "~g~%s~r~%s", "IIIIII", "IIII"); // Fuel is between 50% and 60% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 6)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 7)))
format(FuelStatus, 20, "~g~%s~r~%s", "IIIIIII", "III"); // Fuel is between 60% and 70% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 7)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 8)))
format(FuelStatus, 20, "~g~%s~r~%s", "IIIIIIII", "II"); // Fuel is between 70% and 80% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 8)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 9)))
format(FuelStatus, 20, "~g~%s~r~%s", "IIIIIIIII", "I"); // Fuel is between 80% and 90% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 9)) && (AVehicleData[vehicleid][Fuel] <= MaxFuel))
format(FuelStatus, 20, "~g~%s", "IIIIIIIIII"); // Fuel is between 90% and 100% full (all bars are green)
if (AVehicleData[vehicleid][Fuel] == 0)
format(FuelStatus, 20, "~r~%s", "IIIIIIIIII"); // Fuel is empty (all bars are red)
// Format the final fuel-gauge readout
format(FuelString, 50, TXT_SpeedometerFuel, FuelStatus);
// Display the fuel-gauge
TextDrawSetString(APlayerData[playerid][FuelGauge], FuelString);
// Check if the vehicle is out of fuel
if (AVehicleData[vehicleid][Fuel] == 0)
{
// Stop the engine and turn off the lights
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
}
// Check if the player is not in any plane or helicopter (those cannot be caught by speedcamera's)
if (IsVehicleAirVehicle(vehicleid) == 0)
if (APlayerData[playerid][PlayerClass] != ClassPolice) // Check if the player isn't speeding (cops won't get caught)
CheckPlayerSpeeding(playerid);
}
else
{
// If the player is not inside a vehicle, display an empty string (looks like the speedometer is gone)
TextDrawSetString(APlayerData[playerid][speedometerText], " ");
TextDrawSetString(APlayerData[playerid][FuelGauge], " ");
// Set the speed of the player to 0
APlayerData[playerid][PlayerSpeed] = 0;
}
}
// This timer-function is called when a player picks up a refuelpickup
public RefuelVehicle(playerid)
{
new RefuelMsg[128];
// Get the vehicle-id of the player's vehicle
new vID = GetPlayerVehicleID(playerid);
// Calculate the amount of fuel that needs to be refuelled
new Amount = MaxFuel - AVehicleData[vID][Fuel];
// Calculate the price to refuel
new RefuelPrice = (Amount * RefuelMaxPrice) / MaxFuel;
// Check if the player has enough cash
if (APlayerData[playerid][PlayerMoney] >= RefuelPrice)
{
// Refuel the vehicle
AVehicleData[vID][Fuel] = MaxFuel;
// Withdraw the money from the player
RewardPlayer(playerid, -RefuelPrice, 0);
// Let the player know he refuelled his vehicle
format(RefuelMsg, 128, TXT_RefuelledVehicle, RefuelPrice);
SendClientMessage(playerid, 0xFFFFFFFF, RefuelMsg);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, TXT_CannotRefuelVehicle);
// Allow the player to move again
TogglePlayerControllable(playerid, 1);
return 1;
}
// This function checks if the player is speeding near a speedcamera
CheckPlayerSpeeding(playerid)
{
// Setup local variables
new Name[24], Msg[128];
// Check if the player hasn't been caught speeding recently
if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
{
// Loop through all speedcameras
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this camera has been created
if (ACameras[CamID][CamSpeed] != 0)
{
// Check if the player is the driver of the vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Check if the player's speed is greater than the speed allowed by this camera (no need to process a distance-check if not speeding)
if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed])
{
// Check if the player is near the camera
if (IsPlayerInRangeOfPoint(playerid, 50.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
// Prevent the player being caught multiple times by the same speed-camera
APlayerData[playerid][PlayerCaughtSpeeding] = 20;
// Increase the wanted-level of this player by 1 star
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
// Let the player know he's been caught speeding
SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerCaughtSpeeding);
// Get the name of the player
GetPlayerName(playerid, Name, sizeof(Name));
// Also inform all police players that this player is caught speeding
format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} is caught speeding, pursue and fine him", Name);
Police_SendMessage(Msg);
}
}
}
}
}
}
else // If the player has been caught before, reduce the value until it's 0 again, then he can be caught again
APlayerData[playerid][PlayerCaughtSpeeding]--;
}
// This function processes anti-hack stuff
stock AntiHack(playerid)
{
// Setup local variables
new Float:Armour;
// Skip checking for hacks used by the player if he was reported by the Anti-Hack system already
if (APlayerData[playerid][AutoReportTime] > 0)
{
// Reduce the time so the player can be reported again soon if he doesn't stop using hacks
APlayerData[playerid][AutoReportTime]--;
// Exit the function, this skips the hack-checks until the AutoReportTime has reached 0
// Otherwise the player is reported every half a second until he stops using hacks
return 1;
}
// Check if a filterscript gave some money (or took it) to the player
if (GetPVarInt(playerid, "PVarMoney") != 0)
{
// Add the money to the players account
APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + GetPVarInt(playerid, "PVarMoney");
// Clear the PVar
SetPVarInt(playerid, "PVarMoney", 0);
}
if (GetPVarInt(playerid, "PVarScore") != 0)
{
// Add the money to the players account
APlayerData[playerid][PlayerScore] = APlayerData[playerid][PlayerScore] + GetPVarInt(playerid, "PVarScore");
// Clear the PVar
SetPVarInt(playerid, "PVarScore", 0);
}
// Reset the player's money and set it to the stored value in the player's account (do the same for scorepoints)
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, APlayerData[playerid][PlayerMoney]);
SetPlayerScore(playerid, APlayerData[playerid][PlayerScore]);
// Port anyone out of the area who is not an admin and inside the area 69
Player_PortOutAdminZone(playerid, 106.0, 1805.0, -50.0, 285.0, 1940.0, 40.0, 15.0, 1732.0, 25.0);
// Weapon hacks are also neutralized here, except for police players (if they are allowed to have weapons)
if ((PoliceGetsWeapons == true) && (APlayerData[playerid][PlayerClass] == ClassPolice))
{
// Do nothing
}
else
//ResetPlayerWeapons(playerid); // Remove all weapons from the player
// Check if the player got any armour (= health-hack)
GetPlayerArmour(playerid, Armour);
// Send an automated report to the admins so they're informed about it and can take action
if (Armour > 125.0)
SendReportToAdmins(playerid, "Health-hack", true);
// Check if the speed is higher than 300 (kick player if it is)
// Send an automated report to the admins so they're informed about it and can take action
if (APlayerData[playerid][PlayerSpeed] > 300)
SendReportToAdmins(playerid, "Speed-hack", true);
// Check if the player is not allowed to have a jetpack (admins lvl 3 and higher can use /fly, so they will be excluded)
if (APlayerData[playerid][PlayerLevel] < 3)
{
// Check if the player is using a jetpack
// Send an automated report to the admins so they're informed about it and can take action
if (GetPlayerSpecialAction(playerid) == 2)
SendReportToAdmins(playerid, "Jetpack-hack", true);
}
// Detect airbreak hack
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Check if the player is nearly standing still
if (APlayerData[playerid][PlayerSpeed] < 10)
{
// Check if the player switched interior-id's
if (GetPlayerInterior(playerid) != APlayerData[playerid][PreviousInt])
{
// Check if the new interior is the normal world or any mod-shop
switch (GetPlayerInterior(playerid))
{
case 0, 1, 2, 3: // Check interiors 0, 1, 2 and 3 (normal world and all mod-shops)
{
// Store the player's current location and interior-id for the next iteration
GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
// Exit the function
return 1;
}
}
}
// Check if the player is still near the same place he was half a second ago
if (IsPlayerInRangeOfPoint(playerid, 7.5, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]))
{
}
else // Send an automated report to the admins so they're informed about it and can take action
SendReportToAdmins(playerid, "Airbreak-hack", true);
}
}
// Store the player's current location and interior-id for the next iteration
GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
return 1;
}
[/pawn]
Nu imi mai arata banii is la 0 si scorul la fel, iar daca sterg asta: ResetPlayerMoney(playerid); imi cresc banii si nu se mai opresc dar daca cumpar ceva zice ca n-am bani
-
Cum as putea rezolva problema asta ca numi dau seama nici cum:
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(14) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Pawno script:
[pawn]// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <streamer>
#include <ATM>
#define COLOR_RED 0xFF0000AA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnGameModeInit()
{
for(new i = 0; i < sizeof(AtmInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, AtmInfo[aX], AtmInfo[aY], AtmInfo[aZ]))
{
if(AtmInfo[aCreated] == 1)
{
CreateAtm(-541.3666, 2600.2646, 53.4154, -540.5731, 2600.2578, 53.4141);
return 1;
}
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(robatm,6,cmdtext);
return 1;
}
dcmd_robatm(playerid,params[])
{
#pragma unused params
new string[128];
new crand = random(100);
if(crand <= 30)
{
SendClientMessage(playerid,COLOR_RED,"Rob attempt failed.");
return 1;
}
if(GetPlayerWantedLevel(playerid) < 1)
{
new Want = GetPlayerWantedLevel(playerid);
format(string,sizeof(string),"Players with the $%d wanted level can't rob ATM's.",Want);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
for(new i = 0; i < sizeof(AtmInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, AtmInfo[aX], AtmInfo[aY], AtmInfo[aZ]))
{
if(AtmInfo[aCreated] == 1)
{
new RCash = randomEx(5000,50000);
SendClientMessage(playerid,COLOR_RED,"[[_ATM Robbed_]]");
format(string,sizeof(string),"You have robbed $%d from.",RCash);
SendClientMessage(playerid,COLOR_RED,string);
GivePlayerMoney(playerid,RCash);
SetPlayerWantedLevel(playerid,2);
return 1;
}
}
}
return 1;
}
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum; // Credits Y_Less[/pawn]
Si Includele ATM:
[pawn]#include <a_samp>
#define COLOR_BLUE 0x0000FFAA
#define MAX_ATMS 2000
enum AInfo
{
aCreated,
Float:aX,
Float:aY,
Float:aZ,
Float:arX,
Float:arY,
Float:arZ,
aObject,
};
new AtmInfo[MAX_ATMS][AInfo];
stock CreateAtm(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz)
{
for(new i = 0; i < sizeof(AtmInfo); i++)
{
if(AtmInfo[aCreated] == 0)
{
AtmInfo[aCreated]=1;
AtmInfo[aX]=x;
AtmInfo[aY]=y;
AtmInfo[aZ]=z;
AtmInfo[arX]=rx;
AtmInfo[arY]=ry;
AtmInfo[arZ]=rz;
AtmInfo[aObject] = CreateObject(2942, x, y, z, rx, ry, rz);
CreateDynamicMapIcon(rx, ry, rz, 52, -1,-1,-1, -1, 250.0);
return 1;
}
}
return 0;
}[/pawn]
-
Am un server PPC_Trucking, iar cand intru intr-un casino si vreau sa joc la ruleta sau la altceva cand pariez o suma imi ia banii si mi da inapoi(cred ca ii de la anti-hack dar nush cum sal rezolv)
-
Warning-uri complimare:
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(12) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(12) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(12) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(13) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(13) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(13) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(14) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(14) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(14) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(15) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(15) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(15) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(16) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(16) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(16) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(17) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(17) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(17) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(18) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(18) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(18) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(19) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(19) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(19) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(20) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(20) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(20) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(21) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(21) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(21) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(22) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(22) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(22) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(23) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(23) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(23) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(24) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(24) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(24) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(25) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(25) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(25) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(26) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(26) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(26) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(27) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(27) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(27) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(28) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(28) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(28) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(29) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(29) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(29) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(30) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(30) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(30) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(31) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(31) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(31) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(32) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(32) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(32) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(33) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(33) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(33) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(34) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(34) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(34) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(35) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(35) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(35) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(36) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(36) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(36) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(37) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(37) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(37) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(38) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(38) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(38) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(39) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(39) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(39) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(40) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(40) : warning 202: number of arguments does not match definition
C:\Documents and Settings\SkyNet\Desktop\ATM.pwn(40) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
87 Warnings.
-
Warning 202 de la linia 12---40
[pawn]// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <streamer>
#include <ATM>
#define COLOR_RED 0xFF0000AA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnGameModeInit()
{
CreateAtm(-1967.19995117,252.50000000,34.90000153);
CreateAtm(-1965.80004883,462.79998779,34.79999924);
CreateAtm(-2409.19921875,758.29980469,34.79999924);
CreateAtm(-2580.19995117,819.79998779,49.50000000);
CreateAtm(-2242.30004883,284.10000610,35.00000000);
CreateAtm(-2010.19995117,-267.60000610,34.90000153);
CreateAtm(-1980.59997559,166.10000610,27.29999924);
CreateAtm(-1964.50000000,561.79998779,34.79999924);
CreateAtm(-1768.30004883,580.90002441,34.59999847);
CreateAtm(-1729.30004883,715.20001221,24.70000076);
CreateAtm(-1571.30004883,650.50000000,6.80000019);
CreateAtm(-1682.69995117,1334.19995117,6.69999981);
CreateAtm(-1650.50000000,1202.50000000,13.30000019);
CreateAtm(-2109.60009766,897.50000000,76.30000305);
CreateAtm(-1990.90002441,818.90002441,45.09999847);
CreateAtm(-1963.09997559,696.70001221,46.09999847);
CreateAtm(-1856.30004883,462.00000000,34.79999924);
CreateAtm(-1784.50000000,810.90002441,24.50000000);
CreateAtm(-2457.39990234,501.39999390,29.70000076);
CreateAtm(-2730.19995117,-330.10000610,6.80000019);
CreateAtm(-2137.50000000,-141.80000305,35.00000000);
CreateAtm(-2029.30004883,-102.00000000,34.79999924);
CreateAtm(-2020.90002441,-40.70000076,35.00000000);
CreateAtm(-1613.69995117,167.80000305,3.20000005);
CreateAtm(-1337.69995117,449.89999390,6.80000019);
CreateAtm(-1975.19995117,-869.29998779,31.89999962);
CreateAtm(-1975.19995117,-848.40002441,31.89999962);
CreateAtm(-1982.00000000,620.40002441,34.79999924);
CreateAtm(-2018.50000000,793.59997559,45.09999847);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(robatm,6,cmdtext);
return 1;
}
dcmd_robatm(playerid,params[])
{
#pragma unused params
new string[128];
new crand = random(100);
if(crand <= 30)
{
SendClientMessage(playerid,COLOR_RED,"Rob attempt failed.");
return 1;
}
if(GetPlayerWantedLevel(playerid) < 1)
{
new Want = GetPlayerWantedLevel(playerid);
format(string,sizeof(string),"Players with the $%d wanted level can't rob ATM's.",Want);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
for(new i = 0; i < sizeof(AtmInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, AtmInfo[aX], AtmInfo[aY], AtmInfo[aZ]))
{
if(AtmInfo[aCreated] == 1)
{
new RCash = randomEx(5000,50000);
SendClientMessage(playerid,COLOR_RED,"[[_ATM Robbed_]]");
format(string,sizeof(string),"You have robbed $%d from.",RCash);
SendClientMessage(playerid,COLOR_RED,string);
GivePlayerMoney(playerid,RCash);
SetPlayerWantedLevel(playerid,2);
return 1;
}
}
}
return 1;
}
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum; // Credits Y_Less[/pawn]
-
Filterscriptul:
[pawn]// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <ATM>
#define COLOR_RED 0xFF0000AA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnGameModeInit()
{
CreateAtm(-1967.19995117,252.50000000,34.90000153);
CreateAtm(-1965.80004883,462.79998779,34.79999924);
CreateAtm(-2409.19921875,758.29980469,34.79999924);
CreateAtm(-2580.19995117,819.79998779,49.50000000);
CreateAtm(-2242.30004883,284.10000610,35.00000000);
CreateAtm(-2010.19995117,-267.60000610,34.90000153);
CreateAtm(-1980.59997559,166.10000610,27.29999924);
CreateAtm(-1964.50000000,561.79998779,34.79999924);
CreateAtm(-1768.30004883,580.90002441,34.59999847);
CreateAtm(-1729.30004883,715.20001221,24.70000076);
CreateAtm(-1571.30004883,650.50000000,6.80000019);
CreateAtm(-1682.69995117,1334.19995117,6.69999981);
CreateAtm(-1650.50000000,1202.50000000,13.30000019);
CreateAtm(-2109.60009766,897.50000000,76.30000305);
CreateAtm(-1990.90002441,818.90002441,45.09999847);
CreateAtm(-1963.09997559,696.70001221,46.09999847);
CreateAtm(-1856.30004883,462.00000000,34.79999924);
CreateAtm(-1784.50000000,810.90002441,24.50000000);
CreateAtm(-2457.39990234,501.39999390,29.70000076);
CreateAtm(-2730.19995117,-330.10000610,6.80000019);
CreateAtm(-2137.50000000,-141.80000305,35.00000000);
CreateAtm(-2029.30004883,-102.00000000,34.79999924);
CreateAtm(-2020.90002441,-40.70000076,35.00000000);
CreateAtm(-1613.69995117,167.80000305,3.20000005);
CreateAtm(-1337.69995117,449.89999390,6.80000019);
CreateAtm(-1975.19995117,-869.29998779,31.89999962);
CreateAtm(-1975.19995117,-848.40002441,31.89999962);
CreateAtm(-1982.00000000,620.40002441,34.79999924);
CreateAtm(-2018.50000000,793.59997559,45.09999847);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(robatm,6,cmdtext);
return 1;
}
dcmd_robatm(playerid,params[])
{
#pragma unused params
new string[128];
new crand = random(100);
if(crand <= 30)
{
SendClientMessage(playerid,COLOR_RED,"Rob attempt failed.");
return 1;
}
if(GetPlayerWantedLevel(playerid) < 1)
{
new Want = GetPlayerWantedLevel(playerid);
format(string,sizeof(string),"Players with the $%d wanted level can't rob ATM's.",Want);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
for(new i = 0; i < sizeof(AtmInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, AtmInfo[aX], AtmInfo[aY], AtmInfo[aZ]))
{
if(AtmInfo[aCreated] == 1)
{
new RCash = randomEx(5000,50000);
SendClientMessage(playerid,COLOR_RED,"[[_ATM Robbed_]]");
format(string,sizeof(string),"You have robbed $%d from.",RCash);
SendClientMessage(playerid,COLOR_RED,string);
GivePlayerMoney(playerid,RCash);
SetPlayerWantedLevel(playerid,2);
return 1;
}
}
}
return 1;
}
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum; // Credits Y_Less[/pawn]
-
Cum Rezolv aceasta problema:
C:\Documents and Settings\SkyNet\Desktop\SRV\pawno\include\ATM.inc(33) : error 017: undefined symbol "CreateDynamicMapIcon"
Aici includele ATM:
[pawn]#include <a_samp>
#define COLOR_BLUE 0x0000FFAA
#define MAX_ATMS 2000
enum AInfo
{
aCreated,
Float:aX,
Float:aY,
Float:aZ,
Float:arX,
Float:arY,
Float:arZ,
aObject,
};
new AtmInfo[MAX_ATMS][AInfo];
stock CreateAtm(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz)
{
for(new i = 0; i < sizeof(AtmInfo); i++)
{
if(AtmInfo[aCreated] == 0)
{
AtmInfo[aCreated]=1;
AtmInfo[aX]=x;
AtmInfo[aY]=y;
AtmInfo[aZ]=z;
AtmInfo[arX]=rx;
AtmInfo[arY]=ry;
AtmInfo[arZ]=rz;
AtmInfo[aObject] = CreateObject(2942, x, y, z, rx, ry, rz);
CreateDynamicMapIcon(x, y, z, 52, -1,-1,-1, -1, 250.0);
return 1;
}
}
return 0;
}[/pawn]
-
Am pe samp puse niste bancomate si cum as putea crea un pickup care sa aiva urmatoarele comenzi /withdraw, /balance si /deposit
-
nu am onplayertakedamage am cautat in gm in include si nu am gasit
-
Nu la toti e la fel scade aproape la 0 si apoi in functie de cate gloante ii trag ii creste la loc
Iar in alte cazuri nu scade deloc
-
[pawn]// Heals all players
COMMAND:healall(playerid, params[])
{
// Send the command to all admins so they can see it
SendAdminText(playerid, "/healall", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 3
if (APlayerData[playerid][PlayerLevel] >= 3)
{
// Loop through all players
for (new i; i < MAX_PLAYERS; i++)
if (IsPlayerConnected(i)) // Check if the player is connected
if (IsPlayerInAnyVehicle(i) == 0) // Check if the player isn't inside a vehicle
SetPlayerHealth(i, 100.0); // Heal the player
// Send all players a message to inform them that all players have been healed
SendClientMessageToAll(0x00FF00FF, "All players have been healed!");
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
[/pawn]
-
la comanda /heallall nu am onplayershootplayer si nici in gm nu am gasit(ideea e ca nu e din comanda)
-
Am un server PPC_Trucking si am o problema cu Health la pleyeri(all) cand ma ciurui cu un player is cade viata si cand ar trebuii sa moara ii creste viata la loc cu as putea rezolva asta?
-
Intra pe colorpicker.com si iti alegi culoare dupa care scri 0x(codul culorii de pe colorpicker.com)FF
Ex pt culoarea verde: 0x1BE042FF
-
Am o mica problema cu un skyn system:
C:\Documents and Settings\SkyNet\Desktop\www\SkinSystem\pawno\include\mSelection.inc(196) : error 017: undefined symbol "PlayerTextDrawSetPreviewModel"
C:\Documents and Settings\SkyNet\Desktop\www\SkinSystem\pawno\include\mSelection.inc(197) : error 017: undefined symbol "PlayerTextDrawSetPreviewRot"
[pawn]//
// Model Selection using previews. For SA-MP 0.3x and above.
// - D0erfler 2013
// - Kye 2013
//
// Version 1.1 R2
/*Functions to be used
LoadModelSelectionMenu(f_name[])
HideModelSelectionMenu(playerid)
ShowModelSelectionMenu(playerid, ListID, header_text[], dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)
ShowModelSelectionMenuEx(playerid, items_array[], item_amount, header_text[], extraid, Float:Xrot = 0.0, Float:Yrot = 0.0, Float:Zrot = 0.0, Float:mZoom = 1.0, dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)
*/
// Callbacks
forward OnPlayerModelSelection(playerid, response, listid, modelid);
forward OnPlayerModelSelectionEx(playerid, response, extraid, modelid);
// settings static lists
#define mS_TOTAL_ITEMS 1000 // Max amount of items from all lists
#define mS_TOTAL_LISTS 20 // Max amount of lists
#define mS_TOTAL_ROT_ZOOM 100 // Max amount of items using extra information like zoom or rotations
// settings dynamic per player lists
#define mS_CUSTOM_MAX_ITEMS 20
new gCustomList[MAX_PLAYERS][mS_CUSTOM_MAX_ITEMS];
#define mS_INVALID_LISTID mS_TOTAL_LISTS
#define mS_CUSTOM_LISTID (mS_TOTAL_LISTS+1)
#define mS_NEXT_TEXT "Ileri"
#define mS_PREV_TEXT "Geri"
#define mS_CANCEL_TEXT "Kapat"
#define mS_SELECTION_ITEMS 21
#define mS_ITEMS_PER_LINE 7
#define mS_DIALOG_BASE_X 75.0
#define mS_DIALOG_BASE_Y 130.0
#define mS_DIALOG_WIDTH 550.0
#define mS_DIALOG_HEIGHT 180.0
#define mS_SPRITE_DIM_X 60.0
#define mS_SPRITE_DIM_Y 70.0
new PlayerText:gCurrentPageTextDrawId[MAX_PLAYERS];
new PlayerText:gHeaderTextDrawId[MAX_PLAYERS];
new PlayerText:gBackgroundTextDrawId[MAX_PLAYERS];
new PlayerText:gNextButtonTextDrawId[MAX_PLAYERS];
new PlayerText:gPrevButtonTextDrawId[MAX_PLAYERS];
new PlayerText:gCancelButtonTextDrawId[MAX_PLAYERS];
new PlayerText:gSelectionItems[MAX_PLAYERS][mS_SELECTION_ITEMS];
new gSelectionItemsTag[MAX_PLAYERS][mS_SELECTION_ITEMS];
new gItemAt[MAX_PLAYERS];
#define mS_LIST_START 0
#define mS_LIST_END 1
new gLists[mS_TOTAL_LISTS][2]; // list information start/end index
#define mS_ITEM_MODEL 0
#define mS_ITEM_ROT_ZOOM_ID 1
new gItemList[mS_TOTAL_ITEMS][2];
new Float:gRotZoom[mS_TOTAL_ROT_ZOOM][4]; // Array for saving rotation and zoom info
new gItemAmount = 0; // Amount of items used
new gListAmount = 0; // Amount of lists used
new gRotZoomAmount = 0; // Amount of Rotation/Zoom informations used
//------------------------------------------------
stock mS_GetNumberOfPages(ListID)
{
new ItemAmount = mS_GetAmountOfListItems(ListID);
if((ItemAmount >= mS_SELECTION_ITEMS) && (ItemAmount % mS_SELECTION_ITEMS) == 0)
{
return (ItemAmount / mS_SELECTION_ITEMS);
}
else return (ItemAmount / mS_SELECTION_ITEMS) + 1;
}
//------------------------------------------------
stock mS_GetNumberOfPagesEx(playerid)
{
new ItemAmount = mS_GetAmountOfListItemsEx(playerid);
if((ItemAmount >= mS_SELECTION_ITEMS) && (ItemAmount % mS_SELECTION_ITEMS) == 0)
{
return (ItemAmount / mS_SELECTION_ITEMS);
}
else return (ItemAmount / mS_SELECTION_ITEMS) + 1;
}
//------------------------------------------------
stock mS_GetAmountOfListItems(ListID)
{
return (gLists[ListID][mS_LIST_END] - gLists[ListID][mS_LIST_START])+1;
}
//------------------------------------------------
stock mS_GetAmountOfListItemsEx(playerid)
{
return GetPVarInt(playerid, "mS_custom_item_amount");
}
//------------------------------------------------
stock mS_GetPlayerCurrentListID(playerid)
{
if(GetPVarInt(playerid, "mS_list_active") == 1) return GetPVarInt(playerid, "mS_list_id");
else return mS_INVALID_LISTID;
}
//------------------------------------------------
stock PlayerText:mS_CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos)
{
new PlayerText:txtInit;
txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0");
PlayerTextDrawUseBox(playerid, txtInit, 0);
PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
PlayerTextDrawFont(playerid, txtInit, 1);
PlayerTextDrawSetShadow(playerid, txtInit, 0);
PlayerTextDrawSetOutline(playerid, txtInit, 1);
PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
PlayerTextDrawShow(playerid, txtInit);
return txtInit;
}
//------------------------------------------------
// Creates a button textdraw and returns the textdraw ID.
stock PlayerText:mS_CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[])
{
new PlayerText:txtInit;
txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text);
PlayerTextDrawUseBox(playerid, txtInit, 1);
PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF);
PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF);
PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
PlayerTextDrawFont(playerid, txtInit, 1);
PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow
PlayerTextDrawSetOutline(playerid, txtInit, 0);
PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF);
PlayerTextDrawSetSelectable(playerid, txtInit, 1);
PlayerTextDrawAlignment(playerid, txtInit, 2);
PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does <g>
PlayerTextDrawShow(playerid, txtInit);
return txtInit;
}
//------------------------------------------------
stock PlayerText:mS_CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[])
{
new PlayerText:txtInit;
txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text);
PlayerTextDrawUseBox(playerid, txtInit, 0);
PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0);
PlayerTextDrawFont(playerid, txtInit, 0);
PlayerTextDrawSetShadow(playerid, txtInit, 0);
PlayerTextDrawSetOutline(playerid, txtInit, 1);
PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
PlayerTextDrawShow(playerid, txtInit);
return txtInit;
}
//------------------------------------------------
stock PlayerText:mS_CreatePlayerBGTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, bgcolor)
{
new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos," ~n~"); // enough space for everyone
PlayerTextDrawUseBox(playerid, txtBackground, 1);
PlayerTextDrawBoxColor(playerid, txtBackground, bgcolor);
PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0);
PlayerTextDrawFont(playerid, txtBackground, 0);
PlayerTextDrawSetShadow(playerid, txtBackground, 0);
PlayerTextDrawSetOutline(playerid, txtBackground, 0);
PlayerTextDrawColor(playerid, txtBackground,0x000000FF);
PlayerTextDrawTextSize(playerid, txtBackground, Width, Height);
PlayerTextDrawBackgroundColor(playerid, txtBackground, bgcolor);
PlayerTextDrawShow(playerid, txtBackground);
return txtBackground;
}
//------------------------------------------------
// Creates a model preview sprite
stock PlayerText:mS_CreateMPTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:Xrot, Float:Yrot, Float:Zrot, Float:mZoom, Float:width, Float:height, bgcolor)
{
new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later
PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW);
PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF);
PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, bgcolor);
PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height
PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex);
PlayerTextDrawSetPreviewRot(playerid,txtPlayerSprite, Xrot, Yrot, Zrot, mZoom);
PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1);
PlayerTextDrawShow(playerid,txtPlayerSprite);
return txtPlayerSprite;
}
//------------------------------------------------
stock mS_DestroyPlayerMPs(playerid)
{
new x=0;
while(x != mS_SELECTION_ITEMS) {
if(gSelectionItems[playerid][x] != PlayerText:INVALID_TEXT_DRAW) {
PlayerTextDrawDestroy(playerid, gSelectionItems[playerid][x]);
gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
}
x++;
}
}
//------------------------------------------------
stock mS_ShowPlayerMPs(playerid)
{
new bgcolor = GetPVarInt(playerid, "mS_previewBGcolor");
new x=0;
new Float:BaseX = mS_DIALOG_BASE_X;
new Float:BaseY = mS_DIALOG_BASE_Y - (mS_SPRITE_DIM_Y * 0.33); // down a bit
new linetracker = 0;
new mS_listID = mS_GetPlayerCurrentListID(playerid);
if(mS_listID == mS_CUSTOM_LISTID)
{
new itemat = (GetPVarInt(playerid, "mS_list_page") * mS_SELECTION_ITEMS);
new Float:rotzoom[4];
rotzoom[0] = GetPVarFloat(playerid, "mS_custom_Xrot");
rotzoom[1] = GetPVarFloat(playerid, "mS_custom_Yrot");
rotzoom[2] = GetPVarFloat(playerid, "mS_custom_Zrot");
rotzoom[3] = GetPVarFloat(playerid, "mS_custom_Zoom");
new itemamount = mS_GetAmountOfListItemsEx(playerid);
// Destroy any previous ones created
mS_DestroyPlayerMPs(playerid);
while(x != mS_SELECTION_ITEMS && itemat < (itemamount)) {
if(linetracker == 0) {
BaseX = mS_DIALOG_BASE_X + 25.0; // in a bit from the box
BaseY += mS_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
}
gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gCustomList[playerid][itemat], BaseX, BaseY, rotzoom[0], rotzoom[1], rotzoom[2], rotzoom[3], mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor);
gSelectionItemsTag[playerid][x] = gCustomList[playerid][itemat];
BaseX += mS_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
linetracker++;
if(linetracker == mS_ITEMS_PER_LINE) linetracker = 0;
itemat++;
x++;
}
}
else
{
new itemat = (gLists[mS_listID][mS_LIST_START] + (GetPVarInt(playerid, "mS_list_page") * mS_SELECTION_ITEMS));
// Destroy any previous ones created
mS_DestroyPlayerMPs(playerid);
while(x != mS_SELECTION_ITEMS && itemat < (gLists[mS_listID][mS_LIST_END]+1)) {
if(linetracker == 0) {
BaseX = mS_DIALOG_BASE_X + 25.0; // in a bit from the box
BaseY += mS_SPRITE_DIM_Y + 1.0; // move on the Y for the next line
}
new rzID = gItemList[itemat][mS_ITEM_ROT_ZOOM_ID]; // avoid long line
if(rzID > -1) gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, gRotZoom[rzID][0], gRotZoom[rzID][1], gRotZoom[rzID][2], gRotZoom[rzID][3], mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor);
else gSelectionItems[playerid][x] = mS_CreateMPTextDraw(playerid, gItemList[itemat][mS_ITEM_MODEL], BaseX, BaseY, 0.0, 0.0, 0.0, 1.0, mS_SPRITE_DIM_X, mS_SPRITE_DIM_Y, bgcolor);
gSelectionItemsTag[playerid][x] = gItemList[itemat][mS_ITEM_MODEL];
BaseX += mS_SPRITE_DIM_X + 1.0; // move on the X for the next sprite
linetracker++;
if(linetracker == mS_ITEMS_PER_LINE) linetracker = 0;
itemat++;
x++;
}
}
}
//------------------------------------------------
stock mS_UpdatePageTextDraw(playerid)
{
new PageText[64+1];
new listID = mS_GetPlayerCurrentListID(playerid);
if(listID == mS_CUSTOM_LISTID)
{
format(PageText, 64, "%d/%d", GetPVarInt(playerid,"mS_list_page") + 1, mS_GetNumberOfPagesEx(playerid));
PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText);
}
else
{
format(PageText, 64, "%d/%d", GetPVarInt(playerid,"mS_list_page") + 1, mS_GetNumberOfPages(listID));
PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText);
}
}
//------------------------------------------------
stock ShowModelSelectionMenu(playerid, ListID, header_text[], dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)
{
if(!(0 <= ListID < mS_TOTAL_LISTS && gLists[ListID][mS_LIST_START] != gLists[ListID][mS_LIST_END])) return 0;
mS_DestroySelectionMenu(playerid);
SetPVarInt(playerid, "mS_list_page", 0);
SetPVarInt(playerid, "mS_list_id", ListID);
SetPVarInt(playerid, "mS_list_active", 1);
SetPVarInt(playerid, "mS_list_time", GetTickCount());
gBackgroundTextDrawId[playerid] = mS_CreatePlayerBGTextDraw(playerid, mS_DIALOG_BASE_X, mS_DIALOG_BASE_Y + 20.0, mS_DIALOG_WIDTH, mS_DIALOG_HEIGHT, dialogBGcolor);
gHeaderTextDrawId[playerid] = mS_CreatePlayerHeaderTextDraw(playerid, mS_DIALOG_BASE_X, mS_DIALOG_BASE_Y, header_text);
gCurrentPageTextDrawId[playerid] = mS_CreateCurrentPageTextDraw(playerid, mS_DIALOG_WIDTH - 30.0, mS_DIALOG_BASE_Y + 15.0);
gNextButtonTextDrawId[playerid] = mS_CreatePlayerDialogButton(playerid, mS_DIALOG_WIDTH - 30.0, mS_DIALOG_BASE_Y+mS_DIALOG_HEIGHT+100.0, 50.0, 16.0, mS_NEXT_TEXT);
gPrevButtonTextDrawId[playerid] = mS_CreatePlayerDialogButton(playerid, mS_DIALOG_WIDTH - 90.0, mS_DIALOG_BASE_Y+mS_DIALOG_HEIGHT+100.0, 50.0, 16.0, mS_PREV_TEXT);
gCancelButtonTextDrawId[playerid] = mS_CreatePlayerDialogButton(playerid, mS_DIALOG_WIDTH - 150.0, mS_DIALOG_BASE_Y+mS_DIALOG_HEIGHT+100.0, 50.0, 16.0, mS_CANCEL_TEXT);
SetPVarInt(playerid, "mS_previewBGcolor", previewBGcolor);
mS_ShowPlayerMPs(playerid);
mS_UpdatePageTextDraw(playerid);
SelectTextDraw(playerid, tdSelectionColor);
return 1;
}
//------------------------------------------------------------
stock ShowModelSelectionMenuEx(playerid, items_array[], item_amount, header_text[], extraid, Float:Xrot = 0.0, Float:Yrot = 0.0, Float:Zrot = 0.0, Float:mZoom = 1.0, dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)
{
mS_DestroySelectionMenu(playerid);
if(item_amount > mS_CUSTOM_MAX_ITEMS)
{
item_amount = mS_CUSTOM_MAX_ITEMS;
print("-mSelection- WARNING: Too many items given to \"ShowModelSelectionMenuEx\", increase \"mS_CUSTOM_MAX_ITEMS\" to fix this");
}
if(item_amount > 0)
{
for(new i=0;i<item_amount;i++)
{
gCustomList[playerid] = items_array;
}
SetPVarInt(playerid, "mS_list_page", 0);
SetPVarInt(playerid, "mS_list_id", mS_CUSTOM_LISTID);
SetPVarInt(playerid, "mS_list_active", 1);
SetPVarInt(playerid, "mS_list_time", GetTickCount());
SetPVarInt(playerid, "mS_custom_item_amount", item_amount);
SetPVarFloat(playerid, "mS_custom_Xrot", Xrot);
SetPVarFloat(playerid, "mS_custom_Yrot", Yrot);
SetPVarFloat(playerid, "mS_custom_Zrot", Zrot);
SetPVarFloat(playerid, "mS_custom_Zoom", mZoom);
SetPVarInt(playerid, "mS_custom_extraid", extraid);
gBackgroundTextDrawId[playerid] = mS_CreatePlayerBGTextDraw(playerid, mS_DIALOG_BASE_X, mS_DIALOG_BASE_Y + 20.0, mS_DIALOG_WIDTH, mS_DIALOG_HEIGHT, dialogBGcolor);
gHeaderTextDrawId[playerid] = mS_CreatePlayerHeaderTextDraw(playerid, mS_DIALOG_BASE_X, mS_DIALOG_BASE_Y, header_text);
gCurrentPageTextDrawId[playerid] = mS_CreateCurrentPageTextDraw(playerid, mS_DIALOG_WIDTH - 30.0, mS_DIALOG_BASE_Y + 15.0);
gNextButtonTextDrawId[playerid] = mS_CreatePlayerDialogButton(playerid, mS_DIALOG_WIDTH - 30.0, mS_DIALOG_BASE_Y+mS_DIALOG_HEIGHT+100.0, 50.0, 16.0, mS_NEXT_TEXT);
gPrevButtonTextDrawId[playerid] = mS_CreatePlayerDialogButton(playerid, mS_DIALOG_WIDTH - 90.0, mS_DIALOG_BASE_Y+mS_DIALOG_HEIGHT+100.0, 50.0, 16.0, mS_PREV_TEXT);
gCancelButtonTextDrawId[playerid] = mS_CreatePlayerDialogButton(playerid, mS_DIALOG_WIDTH - 150.0, mS_DIALOG_BASE_Y+mS_DIALOG_HEIGHT+100.0, 50.0, 16.0, mS_CANCEL_TEXT);
SetPVarInt(playerid, "mS_previewBGcolor", previewBGcolor);
mS_ShowPlayerMPs(playerid);
mS_UpdatePageTextDraw(playerid);
SelectTextDraw(playerid, tdSelectionColor);
return 1;
}
return 0;
}
//------------------------------------------------
stock HideModelSelectionMenu(playerid)
{
mS_DestroySelectionMenu(playerid);
SetPVarInt(playerid, "mS_ignore_next_esc", 1);
CancelSelectTextDraw(playerid);
return 1;
}
//------------------------------------------------
stock mS_DestroySelectionMenu(playerid)
{
if(GetPVarInt(playerid, "mS_list_active") == 1)
{
if(mS_GetPlayerCurrentListID(playerid) == mS_CUSTOM_LISTID)
{
DeletePVar(playerid, "mS_custom_Xrot");
DeletePVar(playerid, "mS_custom_Yrot");
DeletePVar(playerid, "mS_custom_Zrot");
DeletePVar(playerid, "mS_custom_Zoom");
DeletePVar(playerid, "mS_custom_extraid");
DeletePVar(playerid, "mS_custom_item_amount");
}
DeletePVar(playerid, "mS_list_time");
SetPVarInt(playerid, "mS_list_active", 0);
mS_DestroyPlayerMPs(playerid);
PlayerTextDrawDestroy(playerid, gHeaderTextDrawId[playerid]);
PlayerTextDrawDestroy(playerid, gBackgroundTextDrawId[playerid]);
PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawId[playerid]);
PlayerTextDrawDestroy(playerid, gNextButtonTextDrawId[playerid]);
PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawId[playerid]);
PlayerTextDrawDestroy(playerid, gCancelButtonTextDrawId[playerid]);
gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gCancelButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
}
}
//------------------------------------------------
public OnPlayerConnect(playerid)
{
// Init all of the textdraw related globals
gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
gCancelButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
for(new x=0; x < mS_SELECTION_ITEMS; x++) {
gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
}
gItemAt[playerid] = 0;
return CallLocalFunction("MP_OPC", "i", playerid);
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MP_OPC
forward MP_OPC(playerid);
//-------------------------------------------
// Even though only Player* textdraws are used in this script,
// OnPlayerClickTextDraw is still required to handle ESC
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(GetPVarInt(playerid, "mS_ignore_next_esc") == 1) {
SetPVarInt(playerid, "mS_ignore_next_esc", 0);
return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
}
if(GetPVarInt(playerid, "mS_list_active") == 0) return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
// Handle: They cancelled (with ESC)
if(clickedid == Text:INVALID_TEXT_DRAW) {
new listid = mS_GetPlayerCurrentListID(playerid);
if(listid == mS_CUSTOM_LISTID)
{
new extraid = GetPVarInt(playerid, "mS_custom_extraid");
mS_DestroySelectionMenu(playerid);
CallLocalFunction("OnPlayerModelSelectionEx", "dddd", playerid, 0, extraid, -1);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
else
{
mS_DestroySelectionMenu(playerid);
CallLocalFunction("OnPlayerModelSelection", "dddd", playerid, 0, listid, -1);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}
return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
}
#if defined _ALS_OnPlayerClickTextDraw
#undef OnPlayerClickTextDraw
#else
#define _ALS_OnPlayerClickTextDraw
#endif
#define OnPlayerClickTextDraw MP_OPCTD
forward MP_OPCTD(playerid, Text:clickedid);
//------------------------------------------------
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(GetPVarInt(playerid, "mS_list_active") == 0 || (GetTickCount()-GetPVarInt(playerid, "mS_list_time")) < 200 /* Disable instant selection */) return CallLocalFunction("MP_OPCPTD", "ii", playerid, _:playertextid);
new curpage = GetPVarInt(playerid, "mS_list_page");
// Handle: cancel button
if(playertextid == gCancelButtonTextDrawId[playerid]) {
new listID = mS_GetPlayerCurrentListID(playerid);
if(listID == mS_CUSTOM_LISTID)
{
new extraid = GetPVarInt(playerid, "mS_custom_extraid");
HideModelSelectionMenu(playerid);
CallLocalFunction("OnPlayerModelSelectionEx", "dddd", playerid, 0, extraid, -1);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
else
{
HideModelSelectionMenu(playerid);
CallLocalFunction("OnPlayerModelSelection", "dddd", playerid, 0, listID, -1);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}
// Handle: next button
if(playertextid == gNextButtonTextDrawId[playerid]) {
new listID = mS_GetPlayerCurrentListID(playerid);
if(listID == mS_CUSTOM_LISTID)
{
if(curpage < (mS_GetNumberOfPagesEx(playerid) - 1)) {
SetPVarInt(playerid, "mS_list_page", curpage + 1);
mS_ShowPlayerMPs(playerid);
mS_UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
}
else
{
if(curpage < (mS_GetNumberOfPages(listID) - 1)) {
SetPVarInt(playerid, "mS_list_page", curpage + 1);
mS_ShowPlayerMPs(playerid);
mS_UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
}
return 1;
}
// Handle: previous button
if(playertextid == gPrevButtonTextDrawId[playerid]) {
if(curpage > 0) {
SetPVarInt(playerid, "mS_list_page", curpage - 1);
mS_ShowPlayerMPs(playerid);
mS_UpdatePageTextDraw(playerid);
PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
} else {
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
return 1;
}
// Search in the array of textdraws used for the items
new x=0;
while(x != mS_SELECTION_ITEMS) {
if(playertextid == gSelectionItems[playerid][x]) {
new listID = mS_GetPlayerCurrentListID(playerid);
if(listID == mS_CUSTOM_LISTID)
{
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
new item_id = gSelectionItemsTag[playerid][x];
new extraid = GetPVarInt(playerid, "mS_custom_extraid");
HideModelSelectionMenu(playerid);
CallLocalFunction("OnPlayerModelSelectionEx", "dddd", playerid, 1, extraid, item_id);
return 1;
}
else
{
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
new item_id = gSelectionItemsTag[playerid][x];
HideModelSelectionMenu(playerid);
CallLocalFunction("OnPlayerModelSelection", "dddd", playerid, 1, listID, item_id);
return 1;
}
}
x++;
}
return CallLocalFunction("MP_OPCPTD", "ii", playerid, _:playertextid);
}
#if defined _ALS_OnPlayerClickPlayerTD
#undef OnPlayerClickPlayerTextDraw
#else
#define _ALS_OnPlayerClickPlayerTD
#endif
#define OnPlayerClickPlayerTextDraw MP_OPCPTD
forward MP_OPCPTD(playerid, PlayerText:playertextid);
//------------------------------------------------------------------
stock LoadModelSelectionMenu(f_name[])
{
new File:f, str[75];
format(str, sizeof(str), "%s", f_name);
f = fopen(str, io_read);
if( !f ) {
printf("-mSelection- WARNING: Failed to load list: \"%s\"", f_name);
return mS_INVALID_LISTID;
}
if(gListAmount >= mS_TOTAL_LISTS)
{
printf("-mSelection- WARNING: Reached maximum amount of lists, increase \"mS_TOTAL_LISTS\"", f_name);
return mS_INVALID_LISTID;
}
new tmp_ItemAmount = gItemAmount; // copy value if loading fails
new line[128], idxx;
while(fread(f,line,sizeof(line),false))
{
if(tmp_ItemAmount >= mS_TOTAL_ITEMS)
{
printf("-mSelection- WARNING: Reached maximum amount of items, increase \"mS_TOTAL_ITEMS\"", f_name);
break;
}
idxx = 0;
if(!line[0]) continue;
new mID = strval( mS_strtok(line,idxx) );
if(0 <= mID < 20000)
{
gItemList[tmp_ItemAmount][mS_ITEM_MODEL] = mID;
new tmp_mS_strtok[20];
new Float:mRotation[3], Float:mZoom = 1.0;
new bool:useRotation = false;
tmp_mS_strtok = mS_strtok(line,idxx);
if(tmp_mS_strtok[0]) {
useRotation = true;
mRotation[0] = floatstr(tmp_mS_strtok);
}
tmp_mS_strtok = mS_strtok(line,idxx);
if(tmp_mS_strtok[0]) {
useRotation = true;
mRotation[1] = floatstr(tmp_mS_strtok);
}
tmp_mS_strtok = mS_strtok(line,idxx);
if(tmp_mS_strtok[0]) {
useRotation = true;
mRotation[2] = floatstr(tmp_mS_strtok);
}
tmp_mS_strtok = mS_strtok(line,idxx);
if(tmp_mS_strtok[0]) {
useRotation = true;
mZoom = floatstr(tmp_mS_strtok);
}
if(useRotation)
{
new bool:foundRotZoom = false;
for(new i=0; i < gRotZoomAmount; i++)
{
if(gRotZoom[0] == mRotation[0] && gRotZoom[1] == mRotation[1] && gRotZoom[2] == mRotation[2] && gRotZoom[3] == mZoom)
{
foundRotZoom = true;
gItemList[tmp_ItemAmount][mS_ITEM_ROT_ZOOM_ID] = i;
break;
}
}
if(gRotZoomAmount < mS_TOTAL_ROT_ZOOM)
{
if(!foundRotZoom)
{
gRotZoom[gRotZoomAmount][0] = mRotation[0];
gRotZoom[gRotZoomAmount][1] = mRotation[1];
gRotZoom[gRotZoomAmount][2] = mRotation[2];
gRotZoom[gRotZoomAmount][3] = mZoom;
gItemList[tmp_ItemAmount][mS_ITEM_ROT_ZOOM_ID] = gRotZoomAmount;
gRotZoomAmount++;
}
}
else print("-mSelection- WARNING: Not able to save rotation/zoom information. Reached maximum rotation/zoom information count. Increase '#define mS_TOTAL_ROT_ZOOM' to fix the issue");
}
else gItemList[tmp_ItemAmount][mS_ITEM_ROT_ZOOM_ID] = -1;
tmp_ItemAmount++;
}
}
if(tmp_ItemAmount > gItemAmount) // any models loaded ?
{
gLists[gListAmount][mS_LIST_START] = gItemAmount;
gItemAmount = tmp_ItemAmount; // copy back
gLists[gListAmount][mS_LIST_END] = (gItemAmount-1);
gListAmount++;
return (gListAmount-1);
}
printf("-mSelection- WARNING: No Items found in file: %s", f_name);
return mS_INVALID_LISTID;
}
stock mS_strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
[/pawn]
-
Imi da undefine simbol SoferJobSet
-
Cum as putea corecta asta:
C:\Documents and Settings\SkyNet\Desktop\samp\pawno\include\PPC_MissionsSofer.inc(15) : warning 204: symbol is assigned a value that is never used: "SoferJobSet"
Aici este scriptul intreg:
[pawn]// Forward the public function used as a timer to load/unload your vehicle
forward Sofer_Tren_LoadUnload(playerid);
// This function is called when a pilot wants to start a job by entering "/work"
Sofer_StartRandomJob(playerid)
{
// Setup local variables
new SoferJobSet;
// Check the vehicle-model of the player to decide which job the player can get
if ((GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTren) || (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTren2))
{
SoferJobSet = Sofer_Tren_SetRandomJob(playerid);
// Setup local variables
new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, LoadMsg[128];
// Job has started
APlayerData[playerid][JobStarted] = true;
// Set jobstep to 1 (going to load the goods)
APlayerData[playerid][JobStep] = 1;
// Get the startlocation, endlocation and the load texts
format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);
// Combine it all into a string for the TextDraw (the player can see this all the time) to describe the mission
format(RouteText, 255, TXT_TransportingFromToPickup, Load, StartLoc, EndLoc);
// Set the TextDraw so the player can see it
TextDrawSetString(APlayerData[playerid][MissionText], RouteText);
// Grab the x, y, z positions for the first location
x = ALocations[APlayerData[playerid][JobLoc1]][LocX];
y = ALocations[APlayerData[playerid][JobLoc1]][LocY];
z = ALocations[APlayerData[playerid][JobLoc1]][LocZ];
// Create a checkpoint where the player should load the goods
SetPlayerCheckpoint(playerid, x, y, z, 7);
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
// Inform the player that he must load his goods
format(LoadMsg, 128, TXT_PickupCargoAt, Load, StartLoc);
SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg);
}
return 1;
}
// This function sets a random job for a plane vehicle and returns 1 if a job has been set
// The function returns 0 if a job couldn't be set (if the player is driving an invalid vehicle to start piloting-jobs)
Sofer_Tren_SetRandomJob(playerid)
{
// If the player is the driver of the vehicle (GetPlayerVehicleSeat returns -1 if the player is not in a vehicle)
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Check the vehicle-model of the player to decide which job the player can get
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTren)
{
// Get a random LoadID from the pilot-products (only the planes)
APlayerData[playerid][LoadID] = Product_GetRandom(PCV_SoferTren);
// Also get a random start-location and end-location
APlayerData[playerid][JobLoc1] = Product_GetRandomStartLoc(APlayerData[playerid][LoadID]);
APlayerData[playerid][JobLoc2] = Product_GetRandomEndLoc(APlayerData[playerid][LoadID]);
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
// Make sure the destination is not closeby (pilot-locations are ALL includes in the array)
while (Locations_CheckDistance(APlayerData[playerid][JobLoc1], APlayerData[playerid][JobLoc2], 1000.0) == 0)
{
// If both locations are too close together, keep searching for a random delivery-location that's further away
APlayerData[playerid][JobLoc2] = Product_GetRandomEndLoc(APlayerData[playerid][LoadID]);
}
APlayerData[playerid][VehicleID] = GetPlayerVehicleID(playerid);
// Return 1 to indicate that a job has been set correctly
return 1;
}
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTren2)
{
// Get a random LoadID from the pilot-products (only the planes)
APlayerData[playerid][LoadID] = Product_GetRandom(PCV_SoferTren2);
// Also get a random start-location and end-location
APlayerData[playerid][JobLoc1] = Product_GetRandomStartLoc(APlayerData[playerid][LoadID]);
APlayerData[playerid][JobLoc2] = Product_GetRandomEndLoc(APlayerData[playerid][LoadID]);
APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
// Make sure the destination is not closeby (pilot-locations are ALL includes in the array)
while (Locations_CheckDistance(APlayerData[playerid][JobLoc1], APlayerData[playerid][JobLoc2], 1000.0) == 0)
{
// If both locations are too close together, keep searching for a random delivery-location that's further away
APlayerData[playerid][JobLoc2] = Product_GetRandomEndLoc(APlayerData[playerid][LoadID]);
}
APlayerData[playerid][VehicleID] = GetPlayerVehicleID(playerid);
// Return 1 to indicate that a job has been set correctly
return 1;
}
}
// If no job could be set correctly, return 0
return 0;
}
// This function is called when a pilot enters a checkpoint
Sofer_OnPlayerEnterCheckpoint(playerid)
{
new LoadMsg[128];
// Check the jobstep
switch (APlayerData[playerid][JobStep])
{
// JobStep is 1 (pilot is loading his goods at the checkpoint)
case 1: format(LoadMsg, 128, TXT_LoadingGoods, ALoads[APlayerData[playerid][LoadID]][LoadName]);
// JobStep is 2 (pilot is unloading his goods at the checkpoint)
case 2: format(LoadMsg, 128, TXT_UnloadingGoods, ALoads[APlayerData[playerid][LoadID]][LoadName]);
}
// Disable the player's actions (he cannot move anymore)
TogglePlayerControllable(playerid, 0);
// Check the vehiclemodel of the player
new vehicleid = GetPlayerVehicleID(playerid);
switch (GetVehicleModel(vehicleid))
{
case VehicleTren, VehicleTren2: // A plane needs 5 seconds to load/unload
{
// Show the message to inform him what he's doing (loading/unloading)
GameTextForPlayer(playerid, LoadMsg, 5000, 5);
// Start a timer (Public function "LoadUnload(playerid)" gets called when the timer runs out)
APlayerData[playerid][LoadingTimer] = SetTimerEx("Sofer_Tren_LoadUnload", 5000, false, "d" , playerid);
}
}
return 1;
}
// After a pilot entered a checkpoint, a timer is created. This function is called when the timer runs out
public Sofer_Tren_LoadUnload(playerid)
{
// Check the JobStep
switch (APlayerData[playerid][JobStep])
{
case 1: // Player must load his goods
{
// Setup local variables
new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, UnloadMsg[100];
// Set JobStep to 2 (unloading goods)
APlayerData[playerid][JobStep] = 2;
// Delete the loading-checkpoint
DisablePlayerCheckpoint(playerid);
// Get the startlocation, endlocation and the load texts
format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);
// Randomly set the load as overloaded (15% chance the load is overloaded)
Sofer_SetRandomOverloaded(playerid);
// Update the missiontext
format(RouteText, 255, TXT_TransportingFromToDeliver, Load, StartLoc, EndLoc);
// Set the TextDraw so the player can see it
TextDrawSetString(APlayerData[playerid][MissionText], RouteText);
if (ALoads[APlayerData[playerid][LoadID]][Mafia] == true)
{
// Add "(ML)" to the missiontext to let the player know his load is wanted by the mafia
format(RouteText, 255, "%s%s", RouteText, " ~r~(ML)~w~");
// If the player is carrying a mafia-load, inform him about it
GameTextForPlayer(playerid, TXT_TruckerMafiaInterested, 5000, 4);
// Also set the data for the player to indicate he's carrying a mafiaload
APlayerData[playerid][MafiaLoad] = true;
// Also set the player's trailer ID (or the vehicle itself) as Mafia-load in the array "AVehicleMafiaLoad"
if (APlayerData[playerid][TrailerID] == 0)
AVehicleData[APlayerData[playerid][VehicleID]][MafiaLoad] = true; // The player has no trailer, so set his main vehicle as wanted by the mafia
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Mafia este interesata de incarcatura ta");
}
// Grab the x, y, z positions for the second location (to unload the goods)
x = ALocations[APlayerData[playerid][JobLoc2]][LocX];
y = ALocations[APlayerData[playerid][JobLoc2]][LocY];
z = ALocations[APlayerData[playerid][JobLoc2]][LocZ];
// Create a checkpoint where the player should unload the goods
SetPlayerCheckpoint(playerid, x, y, z, 7);
// Inform the player that he must unload his goods
format(UnloadMsg, 100, TXT_DeliverCargoTo, Load, EndLoc);
SendClientMessage(playerid, 0xFFFFFFFF, UnloadMsg);
}
case 2: // Player is delivering his goods
{
// Setup local variables
new StartLoc[50], EndLoc[50], Load[50], Msg1[128], Msg2[128], Name[24];
// Get the player name
GetPlayerName(playerid, Name, sizeof(Name));
// Get the startlocation, endlocation and the load texts
format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);
// Construct the message sent to all players that this player completed a pilot mission
format(Msg1, 128, TXT_PlayerCompletedSoferJob, Name, Load);
format(Msg2, 128, TXT_PlayerCompletedSoferJobInfo, StartLoc, EndLoc);
SendClientMessageToAll(0xFFFFFFFF, Msg1);
SendClientMessageToAll(0xFFFFFFFF, Msg2);
// Setup local variables
new Float:x1, Float:y1, Float:x2, Float:y2, Float:Distance, Message[128], Payment, Bonus;
// Grab the x, y, z positions for the first location (to load the goods)
x1 = ALocations[APlayerData[playerid][JobLoc1]][LocX];
y1 = ALocations[APlayerData[playerid][JobLoc1]][LocY];
// Grab the x, y, z positions for the second location (to unload the goods)
x2 = ALocations[APlayerData[playerid][JobLoc2]][LocX];
y2 = ALocations[APlayerData[playerid][JobLoc2]][LocY];
// Calculate the distance between both points
Distance = floatsqroot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
// Calculate the payment for the player
Payment = floatround((Distance * ALoads[APlayerData[playerid][LoadID]][PayPerUnit]), floatround_floor);
// Pay the player based on the distance between the loading-point and unloading-point
RewardPlayer(playerid, Payment, 4);
// Send a message to let the player know he finished his mission and got paid
format(Message, 128, TXT_RewardJob, Payment);
SendClientMessage(playerid, 0xFFFFFFFF, Message);
if (APlayerData[playerid][Overloaded] == true)
{
// Calculate the bonus
Bonus = (Payment * 25) / 100;
// Pay the bonus to the player
RewardPlayer(playerid, Bonus, 0);
// Send a message to let the player know he was overloaded and got paid
format(Message, 128, TXT_TruckerBonusOverloaded, Bonus);
SendClientMessage(playerid, 0xFFFFFFFF, Message);
}
if (APlayerData[playerid][MafiaLoad] == true)
{
// Calculate the bonus
Bonus = (Payment * 50) / 100;
// Pay the bonus to the player
RewardPlayer(playerid, Bonus, 0);
// Send a message to let the player know he was overloaded and got paid
format(Message, 128, TXT_TruckerBonusMafiaLoad, Bonus);
SendClientMessage(playerid, 0xFFFFFFFF, Message);
}
// Increase the stats for completing a pilot job
APlayerData[playerid][statsSoferJobs]++;
// Also save the data (in case the server crashes, progress would be lost)
PlayerFile_Save(playerid);
// End the current pilot job (clear mission-data)
Sofer_EndJob(playerid);
}
}
// Enable the player again (he can move again)
TogglePlayerControllable(playerid, 1);
// Start the engine again (in case the vehicle was a helicopter, where the engine was turned off by entering a checkpoint)
new vehicleid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
return 1;
}
Sofer_SetRandomOverloaded(playerid)
{
// Setup local variables
new Name[24], Msg[128];
// Check the vehicle model that the player is driving
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTren)
{
// The player wasn't driving one of the above vehicle models, so this one can be overloaded
// There is a 15% chance that your load will be overloaded
if (random(100) <= 10)
{
// Set overloaded for this player to True
APlayerData[playerid][Overloaded] = true;
// Add 2 to the player's wanted level
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
// Inform the police this trucker is overloaded
GetPlayerName(playerid, Name, sizeof(Name));
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Ai fost supra-incarcat,evita politia");
format(Msg, 128, "{00FF00}{FFFF00}%s{00FF00} este supraincarcat, prinde-l si amendeaza-l", Name);
Police_SendMessage(Msg);
}
}
return 1;
}
// This function is used to cleanup the current job
Sofer_EndJob(playerid)
{
// Check if a job has started
if (APlayerData[playerid][JobStarted] == true)
{
// Clear all data about the job from the player, so he can start a new one
APlayerData[playerid][JobStarted] = false;
APlayerData[playerid][JobStep] = 0;
APlayerData[playerid][LoadID] = 0;
APlayerData[playerid][JobLoc1] = 0;
APlayerData[playerid][JobLoc2] = 0;
APlayerData[playerid][MafiaLoad] = false;
if (APlayerData[playerid][Overloaded] == true)
{
// Clear the overloaded status of the player
APlayerData[playerid][Overloaded] = false;
// Check if the player has a wanted level of 2 or higher
if (GetPlayerWantedLevel(playerid) >= 2)
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) - 2); // Reduce the wanted level by 2
else
SetPlayerWantedLevel(playerid, 0); // If the player has a wanted level of less than 2, reset the wanted level to 0
}
// Delete the checkpoint
DisablePlayerCheckpoint(playerid);
// Reset the missiontext
TextDrawSetString(APlayerData[playerid][MissionText], Sofer_NoJobText);
// Kill the LoadingTimer
KillTimer(APlayerData[playerid][LoadingTimer]);
}
return 1;
}
[/pawn]
-
Pune sus in script: #include streamer
iar obiectele cu CreateObject le faci CreateDinamicObject
-
Cum as putea rezolva chestia asta:
C:\Documents and Settings\SkyNet\Desktop\™The Server™\pawno\include\alss.inc(152) : warning 235: public function lacks forward declaration (symbol "OnPlayerGiveDamage")
Linie 152 --- 177
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if(damagedid != INVALID_PLAYER_ID)
{
if(ALSS_Team[playerid] != ALSS_Team[damagedid] || ALSS_Team[damagedid] == NO_TEAM && (!ALSS_NoGiveDamage[playerid] && !ALSS_NoTakeDamage[damagedid]))
{
new Float:ALSS_pHp = ALSS_Health[damagedid], Float:ALSS_pArmour = ALSS_Armour[damagedid];
if(ALSS_pArmour-amount < 0.0)
{
SetPlayerArmour(damagedid, 0.0);
if(ALSS_pHp-(ALSS_pArmour-amount) < 0.0)
{
if(ALSS_Killer[damagedid] == INVALID_PLAYER_ID)
{
ALSS_Killer[damagedid] = playerid;
ALSS_KillerReason[damagedid] = weaponid;
}
SetPlayerHealth(damagedid, 0.0);
}
else SetPlayerHealth(damagedid, ALSS_pHp-(ALSS_pArmour-amount));
}
else SetPlayerArmour(damagedid, ALSS_pArmour-amount);
}
}
return (ALSS_CallBacks & ALSS_OPGD ? CallLocalFunction("ALSS_OnPlayerGiveDamage", "iifi", playerid, damagedid, amount, weaponid) : 1);
}
-
Se poate creea o comanda care sa o foloseasca doar un player anume? Daca da m-ati putea ajuta?
4 Error si un Warning
in Arhivă probleme
Posted
Cum pot sa ii dau de capat:
C:\Documents and Settings\SkyNet\Desktop\PICKBANK.pwn(44) : error 003: declaration of a local variable must appear in a compound block
C:\Documents and Settings\SkyNet\Desktop\PICKBANK.pwn(44) : error 017: undefined symbol "file"
C:\Documents and Settings\SkyNet\Desktop\PICKBANK.pwn(44) : warning 215: expression has no effect
C:\Documents and Settings\SkyNet\Desktop\PICKBANK.pwn(44) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\SkyNet\Desktop\PICKBANK.pwn(44) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
[pawn]// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
new banklabel;
#include <a_samp>
#include <streamer>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("---------Filterscript by SkyNet---------");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print("---------Gamemode by SkyNet---------");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
banklabel= CreatePickup(1274, 1, -2320.9971, -1647.2747, 483.7031, 0);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == banklabel)
// Setup local variables
new file[100], Name[24];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/bank", params);
// Get the playername
format(Name, sizeof(Name), APlayerData[playerid][PlayerName]);
// Construct the complete filename for this player's bank-account
format(file, sizeof(file), BankFile, Name);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player doesn't have a bank account
if (!fexist(file))
{
// Ask for a password to setup his bank account
ShowPlayerDialog(playerid, DialogBankPasswordRegister, DIALOG_STYLE_INPUT, "Enter password", "Please enter a password to register your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else // The player has a bank account
{
// If the player hasn't logged in to his bank account yet
if (APlayerData[playerid][bankLoggedIn] == false)
{
// Ask for the password to login to his bank account
ShowPlayerDialog(playerid, DialogBankPasswordLogin, DIALOG_STYLE_INPUT, "Enter password", "Please enter your password to login to your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else // The player has logged in to his bank account already
{
// Show the main bank menu dialog
ShowBankMenu(playerid);
}
}
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
[/pawn]