I got help in my old thread but i tested the fs when i do /opencrate and click for example shotgun and it gives me nothing?
Код:
#include <a_samp>
#include <ZCMD>
#include <sscanf2>
#include <streamer>
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_ORANGE 0xFF8000FF
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_PURPLE 0xC2A2DAAA
#define CRATEGUN 1
new dynamiccrate;
new Text3D:dynamiccrate3DText;
public OnGameModeExit()
{
print("Crate System Shutting Down.");
print("Spawned crates removed.");
DestroyDynamicObject(dynamiccrate);
dynamiccrate = 0;
DestroyDynamic3DTextLabel( Text3D:dynamiccrate3DText );
return 1;
}
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
}
}
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == CRATEGUN)
{
if(response) // If they clicked 'Yes' or pressed enter
{
if(listitem == 0) // Shotgun
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 25, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have purchased a Shotgun!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 1) // MP5
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 29, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a MP5!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 2) // Rifle
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 33, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Rifle!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 3) // Desert Eagle
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 24, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Desert Eagle!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 4) // AK-47
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 30, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken an AK-47!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 5) // M4
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 31, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken an M4!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 6) // SPAS-12
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 27, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a SPAS-12!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 7) // Sniper
{
if(GetPlayerMoney(playerid) >= 100)
{
GivePlayerWeapon(playerid, 34, 99999);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Sniper!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that weapon!");
}
}
if(listitem == 8) // Kevlar vest
{
if(GetPlayerMoney(playerid) >= 100)
{
SetPlayerArmour(playerid, 100.0);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Kevlar vest!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that item!");
}
}
if(listitem == 9)
{
if(GetPlayerMoney(playerid) >= 100)
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a firstaidkit!");
GivePlayerMoney(playerid, -100);
}
else
{
SendClientMessage(playerid, COLOR_GREY," You can't afford that item!");
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
CMD:opencrate(playerid, params[])
{
if(dynamiccrate != 0)
{
new Float:Position[3];
GetDynamicObjectPos(dynamiccrate, Position[0], Position[1], Position[2]);
if(IsPlayerInRangeOfPoint(playerid, 5.0, Position[0], Position[1], Position[2]))
{
ShowPlayerDialog(playerid, CRATEGUN, DIALOG_STYLE_LIST, "Crate Equipment","Shotgun\nMP5\nRifle\nDesert Eagle\nAK-47\nM4\nSPAS-12\nSniper\nKevlar vest\nFirst Aid Kit", "Take", "Cancel");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "* You're not near the crate!");
}
}
return 1;
}
CMD:spawncrate(playerid, params[])
{
if (IsPlayerAdmin(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, "You must be on foot to use this command.");
return 1;
}
new Float:Position[4];
if(dynamiccrate == 0)
{
GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
GetPlayerFacingAngle(playerid, Position[3]);
dynamiccrate = CreateDynamicObject(964, Position[0], Position[1], Position[2]-1.28, 0.0, 0.0, Position[3], -1, -1, -1, 200.0);
dynamiccrate3DText = CreateDynamic3DTextLabel("/opencrate\nTo open the crate.",COLOR_ORANGE,Position[0], Position[1], Position[2]+0.0,8.0);
SetPlayerPos(playerid, Position[0], Position[1], Position[2]+3);
SendClientMessageToAll(COLOR_LIGHTRED, "Crate: The crate has been placed!");
}
else
{
DestroyDynamicObject(dynamiccrate);
dynamiccrate = 0;
DestroyDynamic3DTextLabel( Text3D:dynamiccrate3DText );
SendClientMessageToAll(COLOR_LIGHTRED, "Crate: The crate has been destroyed!");
}
}
return 1;
}
I don't know is this problem, but I have return 1 on the end of OnDialogResponse