How to
#1

Define something like a max money amount?
As i have
Код:
#define Max_MoneyAmount 1000000000
but then how to use GetPlayerMoney on it? xD
Reply
#2

i think it is

Код:
if(GetPlayerMoney[playerid] == your define)
{
// rape player to death
return 1;
}
i think it should be like this
Reply
#3

Edited, the [] should be ()

Also, how to get this working??


Код:
if(GetPlayerWeapon(playerid) - Allowed_Weapons)
(I love to keep all in 1 topic :P )
Reply
#4

Quote:
Originally Posted by Lajko1
i think it is

Код:
if(GetPlayerMoney[playerid] == your define)
{
// rape player to death
return 1;
}
i think it should be like this
>=

its pointless if you have MORE money than your maximum
Reply
#5

can i do On‌ly = or should i rwally do >=?
Reply
#6

If it would be:

pawn Код:
if(GetPlayerMoney(playerid) == 10000)
{
  SetPlayerHealth(playerid, 0);
  SendClientMessage(playerid, 0xFFADSADS, "You can't have more than $10000, but since you had, you died !");
  SendClientMessage(playerid, 0xFFADSADS, "Your money was set to '10000' !");
  SetPlayerMoney(playerid, 10000); //Dunno if you got a function like this..
  return 1;
}
It would kill the player only if he/she would have exactly 10000..


But if you make it

pawn Код:
if(GetPlayerMoney(playerid) > 10000)
{
  SetPlayerHealth(playerid, 0);
  SendClientMessage(playerid, 0xFFADSADS, "You can't have more than $10000, but since you had, you died !");
  SendClientMessage(playerid, 0xFFADSADS, "Your money was set to '10000' !");
  SetPlayerMoney(playerid, 10000); //Dunno if you got a function like this..
  return 1;
}
it kills the player if he got more than 10000. Like 15000, 16000, or 10001...
EDIT: Fixed the fail in the pawn scripts..
Reply
#7

Here's what them symbols actually mean.

pawn Код:
== // The value is equal to the other value.
pawn Код:
>= // The value is more than or equal to the other value.
pawn Код:
<= // The value is less than or equal to the other value.
pawn Код:
> // The value is more than the other value.
pawn Код:
< // The value is less than the other value.
pawn Код:
!= // The value does not equal the other value.
Reply
#8

Quote:
Originally Posted by laser50
can i do On‌ly = or should i rwally do >=?
= just sets it

variable = 1 (means that its now assigned to the number 1)

== compares it

variable == 1 (checks to see if the variable is the same as 1)

>= greater than or equal to

variable >= 1 (my recommendation) (checks to see if the variable is 1 or over)
Reply
#9

Код:
if(GetPlayerWeapon(playerid) == Allowed_Weapons)
on:
Код:
C:\Documents and Settings\Wouter\Bureaublad\Sa-MP Scripting\filterscripts\rcon_cmds.pwn(548) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Wouter\Bureaublad\Sa-MP Scripting\filterscripts\rcon_cmds.pwn(548) : warning 206: redundant test: constant expression is non-zero
Reply
#10

fixed, how to fix this 1??:
C:\Documents and Settings\Wouter\Bureaublad\Sa-MP Scripting\filterscripts\rcon_cmds.pwn(54 : warning 206: redundant test: constant expression is non-zero
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)