Need some help
#1

Hello as I'm new to PAWNO Scripting i tryed to make this command where you cloud buy a 9mm and theres no errors but when i try to use it it don't work and gives me no gun ?


Код:
if(!strcmp(cmdtext, "/Buygun", true, 5))
 	{
 	    IsPlayerInArea(playerid,50,2444.3787,-1976.6405,13.5539);
 	    {
 	        if(GetPlayerMoney(playerid) <= 100)
		  {
 	    		GivePlayerWeapon(playerid,22,100);
	      }
		}
		return 1;
	}
Reply
#2

2 Things could be wrong. It could be either that your not in the area, or have over 100 dollars. It's kinda hard to tell since you don't send error messages when something like that isn't right

Edit: Also noticed that you in the strcmp have put too low a number. It needs to be 7 (or even better delete the number as it is an optional parameter)
Reply
#3

pawn Код:
if(!strcmp(cmdtext, "/Buygun", true))
{
    if(IsPlayerInArea(playerid,50,2444.3787,-1976.6405,13.5539)) //U forgot if () here
    {
        if(GetPlayerMoney(playerid) <= 100)
        {
                GivePlayerWeapon(playerid,22,100);
            }
    }
    return 1;
}
This is untested
Reply
#4

Quote:
Originally Posted by Desert
Посмотреть сообщение
2 Things could be wrong. It could be either that your not in the area, or have over 100 dollars. It's kinda hard to tell since you don't send error messages when something like that isn't right

Edit: Also noticed that you in the strcmp have put too low a number. It needs to be 7 (or even better delete the number as it is an optional parameter)
I'm is in the area but it only works when i got 100$ ? how does i fix that and There is no errors thats why i dint post them.

Quote:
Originally Posted by Mikkel_Pedersen
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext, "/Buygun", true))
{
    if(IsPlayerInArea(playerid,50,2444.3787,-1976.6405,13.5539)) //U forgot if () here
    {
        if(GetPlayerMoney(playerid) <= 100)
        {
                GivePlayerWeapon(playerid,22,100);
            }
    }
    return 1;
}
This is untested
Dint work ;s
Reply
#5

Use some messages to know where the problem is.

pawn Код:
if(!strcmp(cmdtext, "/Buygun", true))
{
    if(IsPlayerInArea(playerid,50,2444.3787,-1976.6405,13.5539))
    {
        if(GetPlayerMoney(playerid) >= 100)
        {
            GivePlayerWeapon(playerid,22,100);
            GivePlayerMoney(playerid, -100);
            SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a weapon");
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You don't have enough money");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "You are not in the area");
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Use some messages to know where the problem is.

pawn Код:
if(!strcmp(cmdtext, "/Buygun", true))
{
    if(IsPlayerInArea(playerid,50,2444.3787,-1976.6405,13.5539))
    {
        if(GetPlayerMoney(playerid) >= 100)
        {
            GivePlayerWeapon(playerid,22,100);
            GivePlayerMoney(playerid, -100);
            SendClientMessage(playerid, 0xFFFFFFFF, "You have bought a weapon");
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You don't have enough money");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "You are not in the area");
    }
    return 1;
}
Some how you fixed it whit that code o.O The problem was that i clouden buy it when i had over 100$ but now i can thank you (:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)