#1

plz tell me how to fix this.I didn't put the response for all dialogs but I named them all.plz get me the correct code.

here is the code:
Код:
// INCLUDES //
#include <a_samp>


// COLORS //
#define COLOR_BASIC 0x0066FFAA
#define COLOR_RED 0xFF0000FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA

////////////////////Car Prices///////////////////

//INSTRUCTIONS:
// Change the 0 to amounce you want the cars to be sold
//V = Car Price
//A =Cars Amount On Buy


//Off Road
#define VBandito 10
#define ABandito 1
#define VBFInjection 122
#define ABFInjection 1
#define VDune 122
#define ADune 1
#define VMesa 956
#define AMesa 1

//Sports Cars
#define VBanshee 66
#define ABanshee 1
#define VBuffalo 88
#define ABuffalo 1
#define VInfernus 99
#define AInfernus 1

//Bikes
#define VBMX 10
#define ABMX 1
#define VQuad 30
#define AQuad 1

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/Carshop", cmdtext, true, 11) == 0)
{
ShowPlayerDialog(playerid, 20320, DIALOG_STYLE_LIST, "Car Shop", "Off Road\nSports Cars\nBikes", "Select", "Exit");
return 1;
}

return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 20320 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Car Shop [Off Road]", "Bandito   25000\nBF Injection 50000\nDune  1000\nMesa 2000", "Buy", "Cancel");
}
case 1:
{
ShowPlayerDialog(playerid, 20322, DIALOG_STYLE_LIST, "Car Shop [Sports Car]", "Banshee   100\nBuffalo 5\nInfernus 500", "Buy", "Cancel");
}
case 2:
{
ShowPlayerDialog(playerid, 20323, DIALOG_STYLE_LIST, "Car Shop [Bikes]", "BMX  5000\nQuad 1000", "Buy", "Cancel");
}
}
}
if(dialogid == 20321 && response)
{
switch(listitem)
{
case 0:
{
if( GetPlayerMoney(playerid)  <  Bandito) return SendClientMessage(playerid, COLOR_RED, "ERROR : You don't have enough money to buy a Brass Knuckle!");
GivePlayerMoney(playerid, -Bandito);
GivePlayerCar(playerid, 1, Bandito);
SendClientMessage(playerid, COLOR_GREEN, "Car Shop : You have succesfully bought a Bandito!");
}
if( GetPlayerMoney(playerid)  <  BF Injection) return SendClientMessage(playerid, COLOR_RED, "ERROR : You don't have enough money to buy a Brass Knuckle!");
GivePlayerMoney(playerid, -BF Injection);
GivePlayerCar(playerid, 1, BF Injection);
SendClientMessage(playerid, COLOR_GREEN, "Car Shop : You have succesfully bought a BF Injection!");
}
}
}
return 1;
}
Reply
#2

Show us the errors..
Reply
#3

sorry abt tht.
here:
Quote:

C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(83) : error 017: undefined symbol "Bandito"
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(84) : error 017: undefined symbol "Bandito"
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(85) : error 017: undefined symbol "GivePlayerCar"
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(8 : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(8 : error 017: undefined symbol "BF"
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(8 : error 029: invalid expression, assumed zero
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(8 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


7 Errors

Reply
#4

First looking through you're code i was like WTF is GivePlayerCar is not even a real function

but i fixed it thought into a real one this one should work fixed all errors and warnings

pawn Код:
// INCLUDES //
#include <a_samp>

// COLORS //
#define COLOR_BASIC 0x0066FFAA
#define COLOR_RED 0xFF0000FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA

////////////////////Car Prices///////////////////

//INSTRUCTIONS:
// Change the 0 to amounce you want the cars to be sold
//V = Car Price
//A =Cars Amount On Buy

//Off Road
#define VBandito 10
#define ABandito 1
#define VBFInjection 122
#define ABFInjection 1
#define VDune 122
#define ADune 1
#define VMesa 956
#define AMesa 1

//Sports Cars
#define VBanshee 66
#define ABanshee 1
#define VBuffalo 88
#define ABuffalo 1
#define VInfernus 99
#define AInfernus 1

//Bikes
#define VBMX 10
#define ABMX 1
#define VQuad 30
#define AQuad 1

//Variables
new Bandito;
new BFInjection;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Carshop", cmdtext, true, 11) == 0) {
        ShowPlayerDialog(playerid, 20320, DIALOG_STYLE_LIST, "Car Shop", "Off Road\nSports Cars\nBikes", "Select", "Exit");
        return 1;
    }

    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 20320 && response) {
        switch(listitem) {
            case 0:
            {
                ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Car Shop [Off Road]", "Bandito   25000\nBF Injection 50000\nDune  1000\nMesa 2000", "Buy", "Cancel");
            }
            case 1:
            {
                ShowPlayerDialog(playerid, 20322, DIALOG_STYLE_LIST, "Car Shop [Sports Car]", "Banshee   100\nBuffalo 5\nInfernus 500", "Buy", "Cancel");
            }
            case 2:
            {
                ShowPlayerDialog(playerid, 20323, DIALOG_STYLE_LIST, "Car Shop [Bikes]", "BMX  5000\nQuad 1000", "Buy", "Cancel");
            }
        }
    }
    if(dialogid == 20321 && response) {
        switch(listitem) {
            case 0:
            {
                if( GetPlayerMoney(playerid)  <  Bandito) return SendClientMessage(playerid, COLOR_RED, "ERROR : You don't have enough money to buy a Brass Knuckle!");
                GivePlayerMoney(playerid, -Bandito);
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,Float:x,Float:y,Float:z);
                CreateVehicle(568,Float:x,Float:y,Float:z,100.0,1,1,15);
                SendClientMessage(playerid, COLOR_GREEN, "Car Shop : You have succesfully bought a Bandito!");
            }
            case 1:
            {
                if( GetPlayerMoney(playerid)  <  BFInjection) return SendClientMessage(playerid, COLOR_RED, "ERROR : You don't have enough money to buy a Brass Knuckle!");
                GivePlayerMoney(playerid, -BFInjection);
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,Float:x,Float:y,Float:z);
                CreateVehicle(424,Float:x,Float:y,Float:z,100.0,1,1,15);
                SendClientMessage(playerid, COLOR_GREEN, "Car Shop : You have succesfully bought a BF Injection!");
            }
        }
    }
    return 1;
}
Reply
#5

I changed some things around but got error agains.plz tell me my mistake and fix it for me any1 plz.
code: http://pastebin.com/s4ABKLEp

errors:
Код:
C:\Users\Jot\Desktop\SAMP Server\filterscripts\CarShop.pwn(83) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#6

That's just a tabulation warning.
pawn Код:
if(blahblahblah(xx))//Good indentation
{
    Player = www;
    Bot = qqq;
    Somebody = Something;
}
else//Bad indentation
{
    Player = ppp;
        Bot = 888;
      Somebody = Nothing;
}
Reply
#7

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
That's just a tabulation warning.
pawn Код:
if(blahblahblah(xx))//Good indentation
{
    Player = www;
    Bot = qqq;
    Somebody = Something;
}
else//Bad indentation
{
    Player = ppp;
        Bot = 888;
      Somebody = Nothing;
}
I didn't get it what u meant.
Reply
#8

Oh my...
You can clearly see there's extra space/tab inside else statement. The warning show up because the code isn't abreast/straight.
Reply
#9

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
Oh my...
You can clearly see there's extra space/tab inside else statement. The warning show up because the code isn't abreast/straight.
show with my code and correct it.
Reply
#10

Maybe it's hard to understand how to fix it, just use

pawn Код:
// After #include < a_samp >
#pragma tabsize 0
A lazy one will use this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)