Need help
#1

I don't get it why is says the error that he already has 5 Coins "The SendClientMessage error"
pawn Код:
if(coin[playerid] < 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;

Reply
#2

Quote:
Originally Posted by Seif_
Elaborate more.
Well, basically, it sends me the error message even though I buy one coin
when it must send me that, when I already have 5 coins.

/buycoins
Reply
#3

You'd have to have the code like this then, correct?

pawn Код:
if(coin[playerid] == 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
Reply
#4

It now checks if the player has less then 5 coins and, if so, returns that he already has 5 coins.
Reply
#5

Quote:
Originally Posted by AK47KILLA
You'd have to have the code like this then, correct?

pawn Код:
if(coin[playerid] == 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
Well, that won't send me the error, it will infinitely give me coins when I /buycoins
Reply
#6

Your code check's if the player has less then 5 coins :P
make it like:
pawn Код:
if(coin[playerid] > 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
Reply
#7

Quote:
Originally Posted by Fj0rtizFredde
Your code check's if the player has less then 5 coins :P
make it like:
pawn Код:
if(coin[playerid] > 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
It still lets me use /buycoins even though I already have 5
OMG, this is really confusing
Reply
#8

Quote:
Originally Posted by ViruZZzZ_ChiLLL
Quote:
Originally Posted by Fj0rtizFredde
Your code check's if the player has less then 5 coins :P
make it like:
pawn Код:
if(coin[playerid] > 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
It still lets me use /buycoins even though I already have 5
OMG, this is really confusing
That is checking if he has more then 5 coins, so 6 would apply.


pawn Код:
if(coin[playerid] >= 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
Reply
#9

Quote:
Originally Posted by Hiddos
Quote:
Originally Posted by ViruZZzZ_ChiLLL
Quote:
Originally Posted by Fj0rtizFredde
Your code check's if the player has less then 5 coins :P
make it like:
pawn Код:
if(coin[playerid] > 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
It still lets me use /buycoins even though I already have 5
OMG, this is really confusing
That is checking if he has more then 5 coins, so 6 would apply.


pawn Код:
if(coin[playerid] >= 5) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
coin[playerid] += 1;
Still... I can /buycoins even though I already have 100000 of them
Reply
#10

Код:
if(coin[playerid] > 4) return SendClientMessage(playerid, Red, "ERROR : You can only have 5 coins!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)