24.04.2014, 13:18
(
Last edited by NviDa; 27/04/2014 at 07:42 AM.
)
I was getting 1 error with dialog,I asked help for it in this same topic.I was just a missing a bracket,fixed it and compiled it.No errors then after compiling but after I tested it in game.It just didn't give me anyweapon.
The pwn code:
This ain't some copy paste code,I made this my self.
Note:-
I have another dialog for spawning a few vehicles ,so maybe that dialog's response is not letting my weapon dialog function maybe?
Pawn code with car dialog and weapon dialog:
The pwn code:
pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#pragma tabsize 0
#define DIALOG_WEAPONS 67
CMD:weapons(playerid, params[])
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST,"Weapons", "Deagle 2500$\nMP5 3000$\nAK-47 4500$\nM4 4500$", "Select", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2500)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 24, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
case 1:
{
if(GetPlayerMoney(playerid) < 3000)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -3000);
GivePlayerWeapon(playerid, 29, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
case 2:
{
if(GetPlayerMoney(playerid) < 4500)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 30, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
case 3:
{
if(GetPlayerMoney(playerid) < 4500)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 31, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
}
}
return 1;
}
Note:-
I have another dialog for spawning a few vehicles ,so maybe that dialog's response is not letting my weapon dialog function maybe?
Pawn code with car dialog and weapon dialog:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 12)
{
if(response == 1)
{
if(listitem == 0)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(411, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 1)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(562, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 2)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(451, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 3)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(520, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 4)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(522, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 5)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(568, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
}
}
if(dialogid == DIALOG_WEAPONS)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2500)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 24, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
case 1:
{
if(GetPlayerMoney(playerid) < 3000)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -3000);
GivePlayerWeapon(playerid, 29, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
case 2:
{
if(GetPlayerMoney(playerid) < 4500)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 30, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
case 3:
{
if(GetPlayerMoney(playerid) < 4500)
return SendClientMessage(playerid, 0x0000FFAA, "You don't have enough cash to buy this Weapon.");
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 31, 1000);
SendClientMessage(playerid, 0x0000FFAA, "You have succesfully buyed your weapon.");
}
}
}
return 1;
}