cmd:buygun or cmd:buyweapon
NGRP |
SQL |
#define DIALOG_WEAPONS 33 //at the top to ignore undifened error.
CMD:buygun(playerid , params[])
{
ShowPlayerDialog(playerid,DIALOG_WEAPONS,DIALOG_STYLE_LIST,"Weapon shop","Ak-47\nM4","ok","cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])//on dialog responding
{
if(dialogid == DIALOG_WEAPONS)//checking if the dialog is the weapons one
{
if(response) //if responding 'pressed ok'
{
//if he choosed list item 0 means ak-47.
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,-1,"You don't have enoght money to afford this weapon.'$3000'");//checking the player money.
GivePlayerWeapon(playerid, 30); //giving him the weapon
}
if(listitem == 1) // if the player select list item 2 'm4'
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,-1,"You don't have enoght money to afford this weapon.'$3000'");//checking the player money.
GivePlayerWeapon(playerid, 31); // Give them a m4
}
}
return 1;
}
return 0;
}
D:\Samp Server\SPRP\SPRP\SPRP\gamemodes\SPRP.pwn(76118) : error 021: symbol already defined: "OnDialogResponse"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])// that's public call back can only be define once.
{
new sendername[MAX_PLAYER_NAME];
new string[128];
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])//here we got second call back of the same function so that's why you got the error.
{
if(dialogid == DIALOG_WEAPONS)//checking if the dialog is the weapons one
{
if(response) //if responding 'pressed ok'
{
//if he choosed list item 0 means ak-47.
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,-1,"You don't have enoght money to afford this weapon.'$3000'");//checking the player money.
GivePlayerWeapon(playerid, 30); //giving him the weapon
}
if(listitem == 1) // if the player select list item 2 'm4'
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,-1,"You don't have enoght money to afford this weapon.'$3000'");//checking the player money.
GivePlayerWeapon(playerid, 31); // Give them a m4
}
}
return 1;
}
return 0;
}