13.05.2014, 15:20
This code and it'll work fine:
And yeah, the identations are messed up as hell. But @Aero, some kind of warnings crash your scripts.
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <ZCMD>
#include <sscanf2>
#include <streamer>
#define endif
#define MAX_OOCSHOP 1000
#define DIALOG_OOCSHOP 32546
enum pInfo
{
pGoldBars,
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" DS");
print("--------------------------------------\n");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_OOCSHOP)
{
if(response)
{
if(listitem == 0)
{
if(PlayerInfo[playerid][pGoldBars] >= 5)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought an exta level up Boost - It will last for 1 Hour");
PlayerInfo[playerid][pRPBoost] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -5;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 1)
{
if(PlayerInfo[playerid][pGoldBars] >= 20)
{
SendClientMessage(playerid, COLOR_WHITE,"You have bought Bronze VIP Status - It will last for 1 Month");
PlayerInfo[playerid][pDonateRank] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -20;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 2)
{
if(PlayerInfo[playerid][pGoldBars] >= 40)
{
SendClientMessage(playerid, COLOR_WHITE,"You have bought Silver VIP Status - It will last for 1 Month");
PlayerInfo[playerid][pDonateRank] = 2;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -40;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 3)
{
if(PlayerInfo[playerid][pGoldBars] >= 70)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought Gold VIP Status - It will last for 1 Month ");
PlayerInfo[playerid][pDonateRank] = 3;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -70;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 4)
{
if(PlayerInfo[playerid][pGoldBars] >= 100)
{
SendClientMessage(playerid, COLOR_WHITE,"You have bought Platinium VIP Status - It will last for 1 Month");
PlayerInfo[playerid][pDonateRank] = 4;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -100;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 5)
{
if(PlayerInfo[playerid][pGoldBars] >= 25)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought a Custom House Ticket - Request it from any Admin using /report");
PlayerInfo[playerid][pHouseTicket] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -25;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 6)
{
if(PlayerInfo[playerid][pGoldBars] >= 50)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought a Custom Business Ticket - Request it from any Admin using /report");
PlayerInfo[playerid][pBusinessTicket] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -50;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 7)
{
if(PlayerInfo[playerid][pGoldBars] >= 25)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought a Custom Vehicle Ticket - Request it from any Admin using /report");
PlayerInfo[playerid][pVehicleTicket] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -25;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem ==
{
if(PlayerInfo[playerid][pGoldBars] >= 25)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought a Custom Garage Ticket - Request it from any Admin using /report");
PlayerInfo[playerid][pGarageTicket] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -25;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 9)
{
if(PlayerInfo[playerid][pGoldBars] >= 20)
{
SendClientMessage(playerid , COLOR_WHITE,"You have bought a Custom Gate Ticket - Request it from any Admin using /report");
PlayerInfo[playerid][pGateTicket] = 1;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -20;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 10)
{
if(PlayerInfo[playerid][pGoldBars] >= 2)
{
SendClientMessage(playerid , COLOR_WHITE,"You have purchased an HP refill.");
SetPlayerHealth(playerid, 100);
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -2;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 11)
{
if(PlayerInfo[playerid][pGoldBars] >= 2)
{
SendClientMessage(playerid , COLOR_WHITE,"You have purchased an Armor refill.");
SetPlayerArmour(playerid, 100);
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -2;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 12)
{
if(PlayerInfo[playerid][pGoldBars] >= 15)
{
SendClientMessage(playerid , COLOR_WHITE,"You have purchased 5 pieces of Paper/Bong/Pipes/Pot/Crack.");
PlayerInfo[playerid][pBong] = PlayerInfo[playerid][pBong] += 5;
PlayerInfo[playerid][pBong] = PlayerInfo[playerid][pPaper] += 5;
PlayerInfo[playerid][pBong] = PlayerInfo[playerid][pPipe] += 5;
PlayerInfo[playerid][pBong] = PlayerInfo[playerid][pPot] += 5;
PlayerInfo[playerid][pBong] = PlayerInfo[playerid][pCrack] += 5;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -15;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
}
}
if(listitem == 13)
{
if(PlayerInfo[playerid][pGoldBars] >= 20)
{
SendClientMessage(playerid , COLOR_WHITE,"You have purchased 700 G-Parts [Gun Parts]");
PlayerInfo[playerid][pBong] = PlayerInfo[playerid][pMats] += 700;
PlayerInfo[playerid][pGoldBars] = PlayerInfo[playerid][pGoldBars] -20;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"ERROR : You don't have enough Gold-Bars ");
PlayerInfo[playerid][pGoldBars] = 0;
}
}
}
return 1;
}
CMDocshop(playerid, params[])
{
GetPlayerName(playerid, sendername, sizeof(sendername));
for(new i = 0; i < sizeof(OOCshopInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, OOCshopInfo[i][OOCshopX], OOCshopInfo[i][OOCshopY], OOCshopInfo[i][OOCshopZ]))
{
ShowPlayerDialog(playerid, DIALOG_OOCSHOP, DIALOG_STYLE_LIST,"OOC Shop Items","EXP Boost - 5 Gold Bars\nBronze VIP - 20 Gold Bar\nSilver VIP - 40 Gold Bar\nGold VIP - 70 Gold Bar\nPlatinum VIP - 100 Gold Bar\nCustom House Ticket - 25 Gold Bar\nCustom Biz Ticket - 50 Gold Bar\nCustom Car Ticket - 25 Gold Bar\nCustom Garage Ticket - 25 Gold bar\nCustom Gate Ticket - 20 Gold Bar\nFull HP - 2 Gold Bars\nFull Armor - 2 Gold Bars\n5 B/P/P/P/C - 15 Gold Bars\n700 GP - 20 Gold Bar","Purchase","Cancel");
return 1;
}
}
SendClientMessage(playerid,COLOR_WHITE,".:: Error : You are not near an OOC Shop");
return 1;
}
CMD:deleteoocshop(playerid, params[])
{
new id, string[128], FileName[128];
if( sscanf( params, "d", id) )
{
if (IsPlayerAdmin(playerid))
{
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /deleteOOCshop [OOCshopid]" );
}
}
else
{
if( PlayerInfo[playerid][pAdmin] >= 1337)
{
format( string, sizeof( string ), "OOCshops/OOCshop_%d.ini", id);
if(!fexist( string) )
{
SendClientMessage( playerid, COLOR_GREY, "Invalid OOCshop ID!" );
return 1;
}
else
{
OOCshopInfo[id][OOCshopX] = 0;
OOCshopInfo[id][OOCshopY] = 0;
OOCshopInfo[id][OOCshopZ] = 0;
OOCshopInfo[id][OOCshopAngle] = 0;
DestroyDynamicObject(OOCshopInfo[id][OOCshopObjectID]);
DestroyDynamic3DTextLabel(OOCshop[id]);
format(string, sizeof(string), "You have deleted the OOCshop (ID: %d).", id);
SendClientMessage( playerid, COLOR_WHITE, string);
format(FileName, sizeof(FileName), "OOCshops/OOCshop_%d.ini", id);
dini_Remove(FileName);
SpawnedOOCshop--;
}
}
}
return 1;
}
CMD:createoocshop(playerid, params[])
{
new Usage[128], string[128];
if( sscanf( params, "s", Usage))
{
if( PlayerInfo[playerid][pAdmin] >= 1337)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createoocshop [name]" );
SendClientMessage(playerid, COLOR_GREY, "Available Names: Exterior and Complete" );
}
}
else
{
if (IsPlayerAdmin(playerid))
{
if(strcmp(Usage, "exterior", true) == 0)
{
PlayerInfo[playerid][OOCshopExterior]++;
GetPlayerPos( playerid, PlayerInfo[playerid][dExtX], PlayerInfo[playerid][dExtY], PlayerInfo[playerid][dExtZ]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][dAngle]);
format( string, sizeof( string ), "Exterior set! (X: %f, Y: %f, Z: %f, A: %f).", PlayerInfo[playerid][dExtX], PlayerInfo[playerid][dExtY], PlayerInfo[playerid][dExtZ], PlayerInfo[playerid][dAngle]);
SendClientMessage( playerid, COLOR_WHITE, string);
}
if(strcmp(Usage, "complete", true) == 0)
{
if(PlayerInfo[playerid][OOCshopExterior] > 0)
{
new NewOOCshopID = SpawnedOOCshop+1;
if(NewOOCshopID >= MAX_OOCSHOP)
{
SendClientMessage( playerid, COLOR_WHITE, "Too many OOCshops are currently spawned!");
}
format( string, sizeof( string ), "OOCshops/OOCshop_%d.ini", NewOOCshopID);
if(dini_Exists(string))
{
SpawnedOOCshop++;
format( string, sizeof( string ), "OOCshop (ID: %d) already exist!", NewOOCshopID);
SendClientMessage( playerid, COLOR_GREY, string);
SendClientMessage( playerid, COLOR_YELLOW, "Please try again by typing /createOOCshop complete" );
}
else
{
OOCshopInfo[NewOOCshopID][OOCshopX] = PlayerInfo[playerid][dExtX];
OOCshopInfo[NewOOCshopID][OOCshopY] = PlayerInfo[playerid][dExtY];
OOCshopInfo[NewOOCshopID][OOCshopZ] = PlayerInfo[playerid][dExtZ];
OOCshopInfo[NewOOCshopID][OOCshopAngle] = PlayerInfo[playerid][dAngle];
dini_Create(string);
dini_FloatSet( string, "X", OOCshopInfo[NewOOCshopID][OOCshopX]);
dini_FloatSet( string, "Y", OOCshopInfo[NewOOCshopID][OOCshopY]);
dini_FloatSet( string, "Z", OOCshopInfo[NewOOCshopID][OOCshopZ]);
dini_FloatSet( string, "Angle", OOCshopInfo[NewOOCshopID][OOCshopAngle]);
PlayerInfo[playerid][OOCshopExterior]--;
SpawnedOOCshop++;
OOCshopInfo[NewOOCshopID][OOCshopObjectID] = CreateDynamicObject(2754, OOCshopInfo[NewOOCshopID][OOCshopX], OOCshopInfo[NewOOCshopID][OOCshopY], OOCshopInfo[NewOOCshopID][OOCshopZ]-0.1, 0, 0, OOCshopInfo[NewOOCshopID][OOCshopAngle],0,0,-1,250);
format(string, sizeof(string), "{FFF1AF}(OOC shop ID : %d){C9FFAB}\nYou can Purchase OOC Items here by using /oocshop", NewOOCshopID);
OOCshop[NewOOCshopID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, OOCshopInfo[NewOOCshopID][OOCshopX],
OOCshopInfo[NewOOCshopID][OOCshopY], OOCshopInfo[NewOOCshopID][OOCshopZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0, 0,-1,-1, 100.0);
SendClientMessage( playerid, COLOR_LIGHTBLUE, "Successfully created an OOC Shop!" );
format(string, sizeof( string ), "You can now use /deleteOOCshop in any Case - OOC Shop ID : %d).", NewOOCshopID);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
else
{
SendClientMessage( playerid, COLOR_GREY, "You are not authorized to use this command!" );
}
}
return 1;
#endif
}