Textdraw
#1

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(playeridGRIS"Type /robstore to this store."); 
    
TextDrawShowForPlayer(playeridpizzabox); 
    
TextDrawShowForPlayer(playeridpizza); 
    
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 
1GivePlayerWeapon(playerid,22,50);//Give the player the weapon they typed the option for 
            
case 2GivePlayerWeapon(playerid,30,50); 
            case 
3GivePlayerWeapon(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 
1GivePlayerWeapon(playerid,22,50);//Give the player the weapon they typed the option for 
            
SendClientMessage(playeridgreen,"You have purchased 9mm for $2,500");
        } 
Reply
#2

PHP код:
switch(strval(text))//Switch through the number they type in. 
        

            case 
1GivePlayerWeapon(playerid,22,50);//Give the player the weapon they typed the option for 
            
SendClientMessage(playeridgreen,"You have purchased 9mm for $2,500");
            
GivePlayerMoney(playerid, -2500);
        } 
Didn't test it , but it should work
Reply
#3

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?
Reply
#4

^^^ 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 
10GivePlayerWeapon(playerid,22,50) && SendClientMessage(playeridROJO,"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(playeridRED"You don't have enough money."); 
Reply
#5

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;
Reply
#6

Thank you SickAttack. It works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)