1 Question & One simple answer
#1

Ok Hey again, And well i've tryed to make


A command that says ERROR:You do not have enough money for this item


And will this code work look bellow


Code:
if(GetPlayerMoney(playerid,0); Return SendClientMessage(playerid,0xFFFFFFF,"ERROR: You need to have $1000 for this item");
Hmm its ment to stop players buying weapons when there money is "0"


So will it work.?

Reply
#2

If i'm not mistaken it should look like this, but i'm pretty sure you would get errors with your code, so why didn't you test it?

Code:
if(GetPlayerMoney(playerid, <= 999)) return SendClientMessage(playerid,0xFFFFFFF,"ERROR: You need to have $1000 for this item");
Reply
#3

Simple answer: It won't.

Neither does the one of Naxix.
Reply
#4

Quote:
Originally Posted by juice.j
Simple answer: It won't.

Neither does the one of Naxix.
Code:
C:\Users\(lewis)\Desktop\hshfdesfdsf.pwn(103) : error 029: invalid expression, assumed zero
C:\Users\(lewis)\Desktop\hshfdesfdsf.pwn(103) : warning 215: expression has no effect
C:\Users\(lewis)\Desktop\hshfdesfdsf.pwn(103) : error 001: expected token: ";", but found ")"
C:\Users\(lewis)\Desktop\hshfdesfdsf.pwn(103) : error 029: invalid expression, assumed zero
C:\Users\(lewis)\Desktop\hshfdesfdsf.pwn(103) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Reply
#5

Quote:
Originally Posted by juice.j
Simple answer: It won't.

Neither does the one of Naxix.
Really depends how you use it.

Example:
Code:
dcmd_buydeagle(playerid,params[])
{
   if(GetPlayerMoney(playerid, <= 999)) return SendClientMessage(playerid,0xFFFFFFF,"ERROR: You need to have $1000 for this item");
   else
   {
      GivePlayerWeapon(playerid,24,100);
   }
   return 1;
}
Else i don't know waht he mean.
Reply
#6

Quote:
Originally Posted by Naxix
Quote:
Originally Posted by juice.j
Simple answer: It won't.

Neither does the one of Naxix.
Really depends how you use it.

Example:
Code:
dcmd_buydeagle(playerid,params[])
{
   if(GetPlayerMoney(playerid, <= 999)) return SendClientMessage(playerid,0xFFFFFFF,"ERROR: You need to have $1000 for this item");
   else


   {
      GivePlayerWeapon(playerid,24,100);
   }
   return 1;
}
Else i don't know waht he mean.

Well i'm kind of a beginner but are give it a try, Still litle confused with this line "dcmd_buydeagle(playerid,params[])"



And this was going to go in a menu.
Reply
#7

Oh, if it's for a menu you have to do something like:

Code:
if(GetPlayerMoney <= 999)
{
   SendClientMessage(playerid,0xFFFFFFF,"ERROR: You need to have $1000 for this item");
}
else
{
   GivePlayerWeapon(playerid,24,100);
}
Reply
#8

Quote:
Originally Posted by Naxix
Oh, if it's for a menu you have to do something like:

Code:
if(GetPlayerMoney <= 999)
{
   SendClientMessage(playerid,0xFFFFFFF,"ERROR: You need to have $1000 for this item");
}
else
{
   GivePlayerWeapon(playerid,24,100);
}
Ah, Yes it is for a menu & thanks.

Reply
#9

Quote:
Originally Posted by Naxix
Really depends how you use it.
Nope it does not, GetPlayerMoney expects one variable, what you're trying to do is logically just wrong - you cannot pass in a comparison.

Same goes for your second example:

Quote:

if(GetPlayerMoney <= 999)

A proper code for the exact description would be:

Code:
if(!GetPlayerMoney(playerid)){

}
This would lead to:

Quote:

stop players buying weapons when there money is "0"

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)