SA-MP Forums Archive
1 Question & One simple answer - 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: 1 Question & One simple answer (/showthread.php?tid=148247)



1 Question & One simple answer - Jay. - 16.05.2010

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.?




Re: 1 Question & One simple answer - Naxix - 16.05.2010

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");



Re: 1 Question & One simple answer - juice.j - 16.05.2010

Simple answer: It won't.

Neither does the one of Naxix.


Re: 1 Question & One simple answer - Jay. - 16.05.2010

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.






Re: 1 Question & One simple answer - Naxix - 16.05.2010

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.


Re: 1 Question & One simple answer - Jay. - 16.05.2010

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.


Re: 1 Question & One simple answer - Naxix - 16.05.2010

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



Re: 1 Question & One simple answer - Jay. - 16.05.2010

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.




Re: 1 Question & One simple answer - juice.j - 16.05.2010

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"