Textdraw - 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: Textdraw (
/showthread.php?tid=576687)
Textdraw -
sscarface - 06.06.2015
I'm using this.
PHP код:
new bool:pizzarobtdentry[MAX_PLAYERS char];//Creating a variable to store if the player is in the checkpoint or not.
//Your code
if(checkpointid == PizzaRob)
{
SendClientMessage(playerid, GRIS, "Type /robstore to this store.");
TextDrawShowForPlayer(playerid, pizzabox);
TextDrawShowForPlayer(playerid, pizza);
pizzarobtdentry{playerid} = true;//Setting the variable to true, because they are in the checkpoint.
}
public OnPlayerText(playerid,text[]){
if(pizzarobtdentry{playerid} == true)//If they are in the checkpoint, they can use the chat to respond to it.
{
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,22,50);//Give the player the weapon they typed the option for
case 2: GivePlayerWeapon(playerid,30,50);
case 3: GivePlayerWeapon(playerid,31,50);
}
TextDrawHideForPlayer(playerid,pizzabox);//hide the textdraws
TextDrawHideForPlayer(playerid,pizza);
pizzarobtdentry{playerid} = false;//Set the variable to false
return 0;//return 0 so that the number they type will not display in the chat.
}
return 1;
}
I'm using this but i want it should remove 1k from player and then give gun to player and also send msg to playerid that you have purchased 9mm. I tried but it didn't work. Anyone help?
PHP код:
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,22,50);//Give the player the weapon they typed the option for
SendClientMessage(playerid, green,"You have purchased 9mm for $2,500");
}
Re: Textdraw -
Crystallize - 06.06.2015
PHP код:
switch(strval(text))//Switch through the number they type in.
{
case 1: GivePlayerWeapon(playerid,22,50);//Give the player the weapon they typed the option for
SendClientMessage(playerid, green,"You have purchased 9mm for $2,500");
GivePlayerMoney(playerid, -2500);
}
Didn't test it , but it should work
Re: Textdraw -
sscarface - 06.06.2015
There's a problem. You can buy things without being in checkpoint. I mean, If you type '1' in main chat you will get 9mm. It should be if player is in checkpoint it gives him the thing. How to fix it?
Re: Textdraw -
sscarface - 06.06.2015
^^^ Fixed. But how to make it like this
PHP код:
if(pizzarobtdentry{playerid} == true)//If they are in the checkpoint, they can use the chat to respond to it.
{
switch(strval(text))//Switch through the number they type in.
{
case 10: GivePlayerWeapon(playerid,22,50) && SendClientMessage(playerid, ROJO,"You have purchased 9mm for $2,500") && GivePlayerMoney(playerid, -2500);
}
return 0;//return 0 so that the number they type will not display in the chat.
}
return 1;
I want to add this msg too
PHP код:
if(GetPlayerMoney(playerid) > 2499) } else SendClientMessage(playerid, RED, "You don't have enough money.");
Re: Textdraw -
SickAttack - 06.06.2015
pawn Код:
if(pizzarobtdentry{playerid})
{
switch(strval(text))
{
case 10:
{
if(GetPlayerMoney(playerid) < 2500) SendClientMessage(playerid, ROJO,"You don't have enough money.");
else
{
GivePlayerWeapon(playerid, 22, 50);
GivePlayerMoney(playerid, -2500);
}
}
}
return 0;
}
return 1;
Re: Textdraw -
sscarface - 06.06.2015
Thank you SickAttack. It works.