How can i let work the variable? - 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)
+--- Thread: How can i let work the variable? (
/showthread.php?tid=301932)
How can i let work the variable? -
Admigo - 06.12.2011
Heey all,
I made a stock and a variable for a shop and a command for showing your clothes.
If i buy a red bandana in slot 1(textdraw) says at my clothes that i have a red bandana(thats good).
But when i buy a black mask the red bandana goes to slot 2 and slot 1 is empty in textdraw.
So there is something not good in variables.
onplayertext myclothes
Код:
if(isinclothesmenu[playerid]==1)
{
new clothesstring[256];
isinclothesmenu[playerid]=0;
isinwearclothes[playerid]=1;
TextDrawHideForPlayer(playerid,TextDraw44);
TextDrawHideForPlayer(playerid,TextDraw45);
TextDrawShowForPlayer(playerid,TextDraw46);
format(clothesstring,sizeof(clothesstring),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- %s~n~~y~ 2 ~w~- %s~n~%s~n~%s~n~%s~n~%s~n~~y~ 7 ~w~- Main Menu~n~~n~~n~ ~w~Press ~y~T~w~ And Enter A ~y~Number~w~!~n~",slotc1(playerid),slotc2(playerid),hasclothes3(playerid),hasclothes4(playerid),hasclothes5(playerid),hasclothes6(playerid));
TextDrawSetString(TextDraw47,clothesstring);//i only tested 2 slots so ignore hasclothes
TextDrawShowForPlayer(playerid,TextDraw47);
return 0;
}
onplayertext buyclothes :
Код:
if(isinbuyclothes1[playerid]==1)//buy clothes
{
if(GetPlayerMoney(playerid)< 455640)
{
SendClientMessage(playerid,COLOR_RED,"You Dont Have Enough Money To Buy A Red Bandana!");
return 0;
}
if(GetPlayerMoney(playerid)==455640||GetPlayerMoney(playerid)> 455640)
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You Have Purchased A Red Bandana!");
SetPVarInt(playerid,"hasclothesid1",1);
GivePlayerMoney(playerid,-455640);
slot1used[playerid]+=1;
return 0;
}
}
if(isinbuyclothes1[playerid]==2)//buy clothes
{
if(GetPlayerMoney(playerid)< 478255)
{
SendClientMessage(playerid,COLOR_RED,"You Dont Have Enough Money To Buy A Black Face Mask!");
return 0;
}
if(GetPlayerMoney(playerid)==478255||GetPlayerMoney(playerid)> 478255)
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You Have Purchased A Black Face Mask!");
SetPVarInt(playerid,"hasclothesid2",1);
GivePlayerMoney(playerid,-478255);
slot1used[playerid]+=1;
return 0;
}
}
slot stocks:
Код:
stock slotc1(playerid)
{
new istr[30];
if(GetPVarInt(playerid,"hasclothesid1")==1 && slot1used[playerid]==1)
{
istr = "Red Bandana";
}
else if(GetPVarInt(playerid,"hasclothesid2")==1 && slot1used[playerid]==1)
{
istr = "Black Face Mask";
}
else if(hasclothesid3[playerid] == 1) istr = "Blue Glasses";
else if(hasclothesid4[playerid] == 1) istr = "Green Cap";
else if(hasclothesid5[playerid] == 1) istr = "White Hockey Mask";
else if(slot1used[playerid]==0)
{
istr = " ";
}
return istr;
}
stock slotc2(playerid)
{
new istr[30];
if(GetPVarInt(playerid,"hasclothesid1")==1 && slot1used[playerid]==2)
{
istr = "Red Bandana";
}
else if(GetPVarInt(playerid,"hasclothesid2")==1 && slot1used[playerid]==2)
{
istr = "Black Face Mask";
}
else if(hasclothesid3[playerid] == 1) istr = "Blue Glasses";
else if(hasclothesid4[playerid] == 1) istr = "Green Cap";
else if(hasclothesid5[playerid] == 1) istr = "White Hockey Mask";
else if(slot1used[playerid]==1)
{
istr = " ";
}
return istr;
}
How to fix the variable pls.
Thanks Admigo
Re: How can i let work the variable? -
Admigo - 06.12.2011
Fixed By Me!