Searching for CMD:?
#1

Hello guys, Am looks for
PHP код:
 cmd:buygun or cmd:buyweapon 
for my Ammunition Biz and my script like
Quote:

NGRP

one but not
Quote:

SQL

Please help
Reply
#2

Bump anyone?
Reply
#3

https://sampwiki.blast.hk/wiki/ShowPlayerDialog Showing dialog , search for styles if you want.
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/GetPlayerMoney Checking the player money.
https://sampwiki.blast.hk/wiki/GivePlayerWeapon Giving weapon.
Example :
pawn Код:
#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;
}
EDIT:If you want to make this command only can be used on some places , you need to use https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#4

I got this error
PHP код:
D:\Samp Server\SPRP\SPRP\SPRP\gamemodes\SPRP.pwn(76118) : error 021symbol already defined"OnDialogResponse"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

LINE
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
sendername[MAX_PLAYER_NAME];
    new 
string[128]; 
Reply
#5

Your dialogresponse already defined , delete one of them i believe that you've copied my codes to your script and you've got the public DialogResponse. example
pawn Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)