SA-MP Forums Archive
Need some help - 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: Need some help (/showthread.php?tid=178661)



Need some help - Basker101 - 23.09.2010

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;
	}



Re: Need some help - Desert - 23.09.2010

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)


Re: Need some help - Mikkel_Pedersen - 23.09.2010

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


Re: Need some help - Basker101 - 23.09.2010

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


Re: Need some help - MadeMan - 23.09.2010

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;
}



Re: Need some help - Basker101 - 23.09.2010

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 (: