Textdraw shop
#1

Hee all.
I made a shop with textdraw. If i setprice off shop nothing happens but if i do showshop it let see the shop but the prices dont change.
Код:
if(gTeam[playerid] != TEAM_GUNDEL)
	{
	TextDrawSetString(TextDraw4,string);
	format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid]);
	}
	if(price > 50000 || price < 2000)
	{
	    SendClientMessage(playerid,COLOR_RED,"Please enter an amount between $2000 and $50000.");
	    return 1;
	}
	SkillPrice[playerid] =price;
	SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Service Price Set_]]");
	format(string,sizeof(string),"You have set your services price to $%d.",SkillPrice[playerid]);
	SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
	return 1;
}
Pls help.

Thanks admigo
Reply
#2

I cant understand you.
Please try speaking einglish man.

This forum requires that you wait 120 seconds between posts. Please try again in 16 seconds.
Reply
#3

Or you are bad in english!Listen good I made a weapon shop for weapon dealers. And if they show the shop to other players everything works fine but when you setprice of the weapons nothing changes.
Reply
#4

Lets say you got a command that set's the price ....
like /setprice

pawn Код:
if(strcmp(cmdtext,"/setprice",true) == 0)
{
     new tmp[256];
     tmp = strtok(cmdtext, idx);//strtok
     if(strlen(tmp)) return 0;//no answer
     new str[256];
     format(str,sizeof(str),"%s",tmp);//format str so we can get the text from the "tmp"
     TextDrawSetString(textdrawid/*((your textdraw)),*/str);//(the string we just formater));
     return 1;
}
Reply
#5

What wrong with this?
Код:
dcmd_setprice(playerid,params[])
{
	new string[128];
	new price;
	if(sscanf(params, "i", price))
	{
	    SendClientMessage(playerid,COLOR_RED,"USAGE: /setprice (Amount)");
	    return 1;
	}
	if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command.");
        return 1;
	}
	if(gTeam[playerid] != TEAM_MEDIC && gTeam[playerid] != TEAM_CARFIX && gTeam[playerid] != TEAM_DRIVER&& gTeam[playerid] != TEAM_GUNDEL)
	{
	    SendClientMessage(playerid,COLOR_RED,"You cannot use this command with your class/skill.");
	    return 1;
	}
	if(gTeam[playerid] != TEAM_GUNDEL)
	{
	TextDrawSetString(TextDraw4,string);
	format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid]);
	}
	if(price > 50000 || price < 2000)
	{
	    SendClientMessage(playerid,COLOR_RED,"Please enter an amount between $2000 and $50000.");
	    return 1;
	}
	SkillPrice[playerid] =price;
	SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Service Price Set_]]");
	format(string,sizeof(string),"You have set your services price to $%d.",SkillPrice[playerid]);
	SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
	return 1;
}
Reply
#6

pawn Код:
if(gTeam[playerid] != TEAM_GUNDEL)
    {
    TextDrawSetString(TextDraw4,string);
    format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid]);
    }
You have TextDrawSetString before you formatted variable "string"

You need to format first
And then set the string

Then replace those lines
With these

pawn Код:
if(gTeam[playerid] != TEAM_GUNDEL)
    {
    format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid]);
TextDrawSetString(TextDraw4,string);
    }
Reply
#7

Strange:S
Dont work:S
Can you test the command?
Reply
#8

Ooh wait it works ty! But i have 10 slots of weapons in the shop but how i change all slots.
look:
Код:
	format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid]
Because if i do this:
Код:
	format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid],SkillPrice[playerid],SkillPrice[playerid],SkillPrice[playerid],SkillPrice[playerid],SkillPrice[playerid],,SkillPrice[playerid],SkillPrice[playerid],SkillPrice[playerid],SkillPrice[playerid]
The line is to big.
Reply
#9

You gonna need 3 variables
lets say
pawn Код:
new Total[700],str1[256],str2[256];
format str1 and str 2....
then format the "Total"
Like this
pawn Код:
format(Total,sizeof(Total),%s %s",str1,str2);
TextDrawSetString(TextDraw4,Total);
pawn Код:
 
Reply
#10

Ty dude i only need one thing.
Код:
dcmd_setprice(playerid,params[])
{
	new string[128];
	new price;
	new number;
	if(sscanf(params, "i", price))
	{
	    //SendClientMessage(playerid,COLOR_RED,"USAGE: /setprice (Amount)");
	    //return 1;
	}
	if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command.");
        return 1;
	}
	if(gTeam[playerid] != TEAM_MEDIC && gTeam[playerid] != TEAM_CARFIX && gTeam[playerid] != TEAM_DRIVER&& gTeam[playerid] != TEAM_GUNDEL)
	{
	    SendClientMessage(playerid,COLOR_RED,"You cannot use this command with your class/skill.");
	    return 1;
	}
	if(gTeam[playerid] != TEAM_GUNDEL)
	{
	format(string,sizeof(string),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",number==1,number==2);//SkillPrice[playerid]
	TextDrawSetString(TextDraw4,string);
	}
	if(gTeam[playerid] != TEAM_GUNDEL)
	{
	    if(sscanf(params, "i",number,price))
		{
			if(number==1)
			{
			SkillPrice[playerid] =price;
			}
			if(number==2)
			{
			SkillPrice[playerid] =price;
			}
		}
	}
	if(price > 50000 || price < 2000)
	{
	    //SendClientMessage(playerid,COLOR_RED,"Please enter an amount between $2000 and $50000.");
	    //return 1;
	}
	SkillPrice[playerid] =price;
	SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Service Price Set_]]");
	format(string,sizeof(string),"You have set your services price to $%d.",SkillPrice[playerid]);
	SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
	return 1;
}
I want to make this command for weapondealer setprice(Shopslot,price);
But how can i make it?
Thats all what i need to know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)