Hello van nekem egy fegyver vásárlós scriptem samp-ba de az a baj vele hogy minuszba is viszi a pénz és azt kellene megoldani hogy ha nincs rá pénz akkor kiirja hogy Nincs elég pénzed!
#include <a_samp>
#include <fixchars>
//====================
new Menu:fegyver;
//====================
#define COLOR_NARANCS 0xFF9900AA
//====================
public OnFilterScriptInit()
{
fegyver = CreateMenu(\"Fegyverek\", 1, 50.0, 180.0, 200.0, 200.0);
AddMenuItem(fegyver, 0, \"Colt45 500 Töltény 10.000$\");
AddMenuItem(fegyver, 0, \"9mm Csendes 100 Töltény 45.000$\");
AddMenuItem(fegyver, 0, \"Tec9 200 Töltény 35.000$\");
AddMenuItem(fegyver, 0, \"Shotgun 100 Töltény 70.000$\");
AddMenuItem(fegyver, 0, \"Uzi 200 Töltény 35.000$\");
AddMenuItem(fegyver, 0, \"MP5 100 Töltény 65.000$\");
AddMenuItem(fegyver, 0, \"AK-47 100 Töltény 90.000$\");
AddMenuItem(fegyver, 0, \"M4 100 Töltény 90.000$\");
AddMenuItem(fegyver, 0, \"Sniper 50 Töltény 100.000$\");
AddMenuItem(fegyver, 0, \"D.Eagle 100 Töltény 55.000$\");
AddMenuItem(fegyver, 0, \"Com.Shotgun 100 Töltény 140.000$\");
AddMenuItem(fegyver, 0, \"Rifle 100 Töltény 60.000$\");
return 1;
}
//====================
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(\"/fegyver vesz\", cmdtext, true) == 0)
{
ShowMenuForPlayer(fegyver, playerid);
TogglePlayerControllable(playerid, 0);
return 1;
}
return 0;
}
//====================
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:valtozo;
valtozo = GetPlayerMenu(playerid);
if(valtozo == fegyver)
{
switch(row)
{
case 0:
{
GivePlayerWeapon(playerid,22, 500);
GivePlayerMoney(playerid, - 10000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 1:
{
GivePlayerWeapon(playerid,23, 100);
GivePlayerMoney(playerid, - 45000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 2:
{
GivePlayerWeapon(playerid,32, 200);
GivePlayerMoney(playerid, - 35000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 3:
{
GivePlayerWeapon(playerid,25, 100);
GivePlayerMoney(playerid, - 70000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 4:
{
GivePlayerWeapon(playerid,28, 200);
GivePlayerMoney(playerid, - 35000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 5:
{
GivePlayerWeapon(playerid,29, 100);
GivePlayerMoney(playerid, - 65000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 6:
{
GivePlayerWeapon(playerid,30, 100);
GivePlayerMoney(playerid, - 90000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 7:
{
GivePlayerWeapon(playerid,31, 100);
GivePlayerMoney(playerid, - 90000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 8:
{
GivePlayerWeapon(playerid,34, 50);
GivePlayerMoney(playerid, - 100000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 9:
{
GivePlayerWeapon(playerid,24, 100);
GivePlayerMoney(playerid, - 55000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 10:
{
GivePlayerWeapon(playerid,27, 100);
GivePlayerMoney(playerid, - 140000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 11:
{
GivePlayerWeapon(playerid,33, 100);
GivePlayerMoney(playerid, - 60000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 12:
{
GivePlayerWeapon(playerid,26, 100);
GivePlayerMoney(playerid, - 70000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 13:
{
GivePlayerWeapon(playerid,39, 20);
GivePlayerMoney(playerid, - 40000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
case 14:
{
GivePlayerWeapon(playerid,40, 1);
GivePlayerMoney(playerid, - 5000);
new name[256];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid,1);
}
}
}
return 1;
}
//====================
public OnPlayerExitedMenu(playerid)
{
TogglePlayerControllable ( playerid , true );
return 1;
}
//====================