SA-MP Forums Archive
Textdrawstring crash:S - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdrawstring crash:S (/showthread.php?tid=259135)



Textdrawstring crash:S - Admigo - 03.06.2011

Heey all,
i made a weapondealer job and he has a shop of 12 weapons. I have a setprice command for every slot. But when i set more then 4 prices my samp crash:S
Here is command:
Код:
if(gTeam[playerid] == TEAM_GUNDEL)
	{
	new slot, price2;
    new Total[700],str1[256],str2[256];
    if(sscanf(params, "dd", slot, price2))
    {
        SendClientMessage(playerid,COLOR_RED,"USAGE: /setprice (slot) (price)");
        return 1;
    }
    if(slot < 1 || slot >= sizeof(WeaponPrices[]))
    {
        SendClientMessage(playerid,COLOR_RED,"Invalid slot");
        return 1;
    }
    if(price2 > 50000 || price2 < 1000)
	{
	    SendClientMessage(playerid,COLOR_RED,"Please enter an amount between $1000 and $50000.");
	    return 1;
	}
    WeaponPrices[playerid][slot] = price2;
    format(string,sizeof(string),"You have set weapon slot %d price to $%d", slot, price2);
    SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
    format(str1,sizeof(str1),"~n~~n~~n~~n~      ~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d",WeaponPrices[dealerid][1],WeaponPrices[dealerid][2],WeaponPrices[dealerid][3],WeaponPrices[dealerid][4],WeaponPrices[dealerid][5]);
	format(str2,sizeof(str2),"~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d~n~",WeaponPrices[dealerid][6],WeaponPrices[dealerid][7],WeaponPrices[dealerid][8],WeaponPrices[dealerid][9],WeaponPrices[dealerid][10],WeaponPrices[dealerid][11],WeaponPrices[dealerid][12]);
	format(Total,sizeof(Total),"%s %s",str1,str2);

	TextDrawSetString(TextDraw5,Total);
    return 1;
	}
	if(price > 50000 || price < 1000)
	{
	    SendClientMessage(playerid,COLOR_RED,"Please enter an amount between $1000 and $50000.");
	    return 1;
	}
And the showweapons command:
Код:
TextDrawShowForPlayer(ID,TextDraw4);
		TextDrawShowForPlayer(ID,TextDraw7);
		//TextDrawShowForPlayer(ID,TextDraw5);
		format(str1,sizeof(str1),"~n~~n~~n~~n~      ~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d",WeaponPrices[ID][1],WeaponPrices[ID][2],WeaponPrices[ID][3],WeaponPrices[ID][4],WeaponPrices[ID][5]);
 		format(str2,sizeof(str2),"     ~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d~n~~y~~b~500 ammo     $%d~n~",WeaponPrices[ID][6],WeaponPrices[ID][7],WeaponPrices[ID][8],WeaponPrices[ID][9],WeaponPrices[ID][10],WeaponPrices[ID][11],WeaponPrices[ID][12]);
		format(Total,sizeof(Total),"%s %s",str1,str2);
		TextDrawSetString(TextDraw5,Total);
		TextDrawShowForPlayer(ID,TextDraw5);
		format(str3,sizeof(str3),"~g~%s's Weaponshop",PlayerName(ID));
		TextDrawSetString(TextDraw6,str3);
		TextDrawShowForPlayer(ID,TextDraw6);
		armshop[ID]=1;
		SetPVarInt(ID, "arm1", playerid);if(IsPlayerConnected(playerid)==1)
What is wrong with this?

Thanks admigo