Command not working!
#1

Код:
if (strcmp(cmdtext, "/buyaccess", true) == 0)
	{
    if (GetPlayerMoney(playerid) >= 10000000)
    {
		SendClientMessage(playerid, 0x33AA33AA, "You just bought access to weapon store!");
		gGunAccess[playerid] += 1;
    SetPlayerMoney(playerid, gPlayerMoney[playerid] - 10000000);
    return 1;
  }
		if(GetPlayerMoney(playerid) < 1000000)
	{
		return SendClientMessage(playerid, 0xAA3333AA, "You have not enough money!");
	}
     return 1;
     }
whats wrong with this command? when i type it nothing happens... ;(
Reply
#2

Is your OnPlayerCommandText returning 0?
Reply
#3

I've got a question, what happens when either return is 0 or 1 onplayercommandtext? I dun get it..
Reply
#4

Quote:
Originally Posted by Izanagi
I've got a question, what happens when either return is 0 or 1 onplayercommandtext? I dun get it..
If you don't return 0, then your command won't work.
Reply
#5

Quote:
Originally Posted by Swift_
Is your OnPlayerCommandText returning 0?
Yes!
Reply
#6

someone?
Reply
#7

Its not important if the commandtext return 0, 1 or any other value!

The problem you had you checked if the player have 10'000'000 money and if he have less than 1'000'000, also if you have something between 1'000'000 and 10'000'000 money, you wont get any message

That maybe happend because the numbers are unreadable if they arent grouped
You could have used else, with that you wouldnt have had this problem

pawn Код:
if (strcmp(cmdtext, "/buyaccess", true) == 0)
    {
        if (GetPlayerMoney(playerid) >= 10_000_000)
        { //with that is the number better readable, pawn supports this (source: pawn-lang.pdf)
            SendClientMessage(playerid, 0x33AA33AA, "You just bought access to weapon store!");
            SetPlayerMoney(playerid, gPlayerMoney[playerid] - 10000000);
            gGunAccess[playerid] += 1;
        }
        else    SendClientMessage(playerid, 0xAA3333AA, "You have not enough money!");
        return  true;
    }
Reply
#8

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Its not important if the commandtext return 0, 1 or any other value!

The problem you had you checked if the player have 10'000'000 money and if he have less than 1'000'000, also if you have something between 1'000'000 and 10'000'000 money, you wont get any message

That maybe happend because the numbers are unreadable if they arent grouped
You could have used else, with that you wouldnt have had this problem

pawn Код:
if (strcmp(cmdtext, "/buyaccess", true) == 0)
    {
        if (GetPlayerMoney(playerid) >= 10_000_000)
        { //with that is the number better readable, pawn supports this (source: pawn-lang.pdf)
            SendClientMessage(playerid, 0x33AA33AA, "You just bought access to weapon store!");
            SetPlayerMoney(playerid, gPlayerMoney[playerid] - 10000000);
            gGunAccess[playerid] += 1;
        }
        else    SendClientMessage(playerid, 0xAA3333AA, "You have not enough money!");
        return  true;
    }
I like the way you handle large integers. Thanks for showing us, people who didn't read ALL pawn-lang.pdf, this way. It sure helps out at certain points ;]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)