How would I.. - 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: How would I.. (
/showthread.php?tid=97543)
How would I.. -
_Vortex - 14.09.2009
In a command, I want to make it check what the player money is, then if its below the defined ammount, then it sends them a message saying not enough money bla bla.
I've tried..
pawn Код:
if(GetPlayeMoney(playerid < 800))
{
SendClientMessage(playerid,COLOR_RED,"ERROR: Not enough money!");
}
But I get bugs.
Re: How would I.. -
Donny_k - 15.09.2009
Read your errors dude, you should be able to see what is wrong there.
Re: How would I.. -
shady91 - 15.09.2009
pawn Код:
if(GetPlayeMoney(playerid < 800))
{
SendClientMessage(playerid,COLOR_RED,"ERROR: Not enough money!");
return 1;
}
simple as that.
or
pawn Код:
if(GetPlayeMoney(playerid < 800))
{
//do somthing here
}else{SendClientMessage(playerid,COLOR_RED,"ERROR: Not enough money!");
return 1;
}
Re: How would I.. -
Donny_k - 15.09.2009
That's still wrong Shady, look at the statement line.
Re: How would I.. -
shady91 - 15.09.2009
pawn Код:
}
if(strcmp(cmd, "/yourcmd", true) == 0)
{
if(GetPlayerMoney(playerid) > 800)
{
// do somthing here
}
else
{
SendClientMessage(COLOR_DBLUE, playerid, "You Need At Least $800");
}
return 1;
Re: How would I.. -
Donny_k - 15.09.2009
Good man.
Would be better like this though IMO:
pawn Код:
if ( !strcmp( cmdtext, COMMAND, true, LENGTH ) )
{
if ( GetPlayeMoney( playerid ) < 800 ) ) return SendClientMessage(playerid,COLOR_RED,"You Need At Least $800");
//success code goes here
return 1;
}
I like coding for false, it makes your code smaller so it takes like lines and is easier to debug as there is less of it etc but that's just my style, each to their own.
Re: How would I.. -
iLinx - 15.09.2009
Quote:
Originally Posted by Donny
Good man.
Would be better like this though IMO:
pawn Код:
if ( !strcmp( cmdtext, COMMAND, true, LENGTH ) ) { if ( GetPlayeMoney( playerid ) < 800 ) ) return SendClientMessage(playerid,COLOR_RED,"You Need At Least $800"); //success code goes here return 1; }
I like coding for false, it makes your code smaller so it takes like lines and is easier to debug as there is less of it etc but that's just my style, each to their own.
|
im exactly like that two :]
Re: How would I.. -
Hiitch - 15.09.2009
or
pawn Код:
if(GetPlayerMoney(playerid) < 800 ) return SendClientMessage(playerid, 0xFF0000FF, "You dont have enough money !");
Re: How would I.. -
shady91 - 15.09.2009
Quote:
Originally Posted by Hiitch[WS
- WestSide Servers ]
or
pawn Код:
if(GetPlayerMoney(playerid) < 800 ) return SendClientMessage(playerid, 0xFF0000FF, "You dont have enough money !");
|
thats what donny did.
Re: How would I.. -
_Vortex - 15.09.2009
Thanks for all your help, guys.