SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/05/2013, 04:31 PM   #1
razor steven
Big Clucker
 
Join Date: Jun 2012
Posts: 71
Reputation: -4
Default Business problem- Zgaming roleplay...

Zgaming roleplay gamemode has dynamic business system with level system.

The problem is, Whatever the level of a business maybe, I can buy any item. Like Gascan is a level 5 item. Which means if the market doesn't have level 5, no one will be able to buy it. If the market have level 5, then it will be buyable.
But it is not working that way. Level 5 items can be bought from level 1 market...
How do I fix it?

Here's the code...

Code:
CMD:prices(playerid, params[])
{
	new idx = GetPlayerVirtualWorld(playerid)-100, string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 1 && BizInfo[idx][bType] != 2 && BizInfo[idx][bType] != 3 && BizInfo[idx][bType] != 4 && BizInfo[idx][bType] != 6 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
    if(BizInfo[idx][bType] == 1)
	{
	    format(string, sizeof(string), "** %s's 24/7 Market menu list **", BizInfo[idx][bOwner]);
	    SendClientMessage(playerid, COLOR_ORANGE, string);
		if(BizInfo[idx][bLevel] >= 1) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 1: Cellphone ($100) | Phonebook ($50) | Dice ($20) | Cigar ($100)");
		if(BizInfo[idx][bLevel] >= 2) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 2: Speedometer ($200) | Sprunk ($30) | Spraycan ($100) | Rope ($60)");
		if(BizInfo[idx][bLevel] >= 3) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 3: Blindfold ($60) | WalkieTalkie ($200) | Smartphone($500)");
		if(BizInfo[idx][bLevel] >= 4) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 4: Camera ($300) | GasCan ($100)");
		//if(BizInfo[idx][bLevel] >= 5) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 5: Radio ($300)");
	}
	else if(BizInfo[idx][bType] == 3)
	{
	    format(string, sizeof(string), "** %s's Ammunation menu list **", BizInfo[idx][bOwner]);
	    SendClientMessage(playerid, COLOR_ORANGE, string);
		if(BizInfo[idx][bLevel] >= 1) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 1: 1) Shotgun Ammo ($400) | 2) Rifle Ammo ($2000)");
		if(BizInfo[idx][bLevel] >= 4) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 2: 3) Gun Ammo ($800)");
		if(BizInfo[idx][bLevel] >= 2) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 3: 4) Light-Machinegun Ammo ($1200)");
		if(BizInfo[idx][bLevel] >= 3) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 4: 5) Heavy-Machinegun Ammo ($2200)");
		if(BizInfo[idx][bLevel] >= 5) SendClientMessage(playerid, COLOR_WHITE, "UPGRADE 5: 6) Vest ($1000)");
	}
	else if(BizInfo[idx][bType] == 4)
	{
	    format(string, sizeof(string), "** %s's Club menu list **", BizInfo[idx][bOwner]);
	    SendClientMessage(playerid, COLOR_ORANGE, string);
		SendClientMessage(playerid, COLOR_WHITE, "1) Sprunk ($50) | 2) Beer ($100) | 3) Vodka ($200)");
	}
	else if(BizInfo[idx][bType] == 6)
	{
	    format(string, sizeof(string), "** %s's Fast Food menu list **", BizInfo[idx][bOwner]);
	    SendClientMessage(playerid, COLOR_ORANGE, string);
		SendClientMessage(playerid, COLOR_WHITE, "1) Small Meal ($10) | 2) Medium Meal ($30) | 3) Big Meal ($50)");
	}
	return 1;
}
__________________
United States Roleplay ~US:RP...

Awesome server with UNIQUE features.
Come and join US:RP today, Bet you're gonna love it.


212.227.143.24:8490

www.us-rp.com
razor steven is offline   Reply With Quote
Old 25/05/2013, 12:42 AM   #2
Krakuski
Huge Clucker
 
Krakuski's Avatar
 
Join Date: Jul 2012
Location: Japan
Posts: 200
Reputation: 18
Default Re: Business problem- Zgaming roleplay...

Add this line to after every line in the /buy command.

For example:

HINT: make sure to look for the //RIGHT HERE VVVVVVVVVVVV messages

pawn Code:
CMD:buy(playerid, params[])
{
    new idx = GetPlayerVirtualWorld(playerid)-100, string[128], type, price;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 1 && BizInfo[idx][bType] != 2 && BizInfo[idx][bType] != 3 && BizInfo[idx][bType] != 4 && BizInfo[idx][bType] != 6 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
    if(BizInfo[idx][bType] == 1)
    {
        if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy [item]");
        if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products.");
//RIGHT HERE VVVVVVVVVVVV
        if(BizInfo[idx][bLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "This 24/7 Market doesn't have this product yet."); //ADD THIS DEPENDING ON THE LEVEL
//THIS LINE HERE ^^^^^^^^^^
        if(!strcmp(params, "cellphone", true))
        {

            if(PlayerInfo[playerid][pMoney] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this.");
            new randphone = random(1000) + random(8999);//minimum 100  max 9999
            PlayerInfo[playerid][pNumber] = randphone;
            PlayerInfo[playerid][pHasCellphone] = 1;
            BizInfo[idx][bMoney] += 100;
            BizInfo[idx][bProducts] --;
            BizInfo[idx][bSold] ++;
            GiveDodMoney(playerid, -100);
            format(string, sizeof(string), "* %s has bought a cellphone for $100.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_WHITE, " (( Check /stats to check your new Phone Number ))");
        }
        if(!strcmp(params, "phonebook", true))
        {
Krakuski is offline   Reply With Quote
Old 25/05/2013, 07:17 AM   #3
razor steven
Big Clucker
 
Join Date: Jun 2012
Posts: 71
Reputation: -4
Default Re: Business problem- Zgaming roleplay...

Thank you very much

+REP
__________________
United States Roleplay ~US:RP...

Awesome server with UNIQUE features.
Come and join US:RP today, Bet you're gonna love it.


212.227.143.24:8490

www.us-rp.com

Last edited by razor steven; 25/05/2013 at 07:58 AM.
razor steven is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[GameMode] zGaming Roleplay iRage Gamemode Scripts 1004 25/12/2017 04:26 PM


All times are GMT. The time now is 08:57 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.