How to make %d say the amount of cash earnt
#1

Already so i'v been puzzled on this and really had no idea.

this is my code.

Код:
GivePlayerMoney(playerid,random(10000-5000)+5000);
SendClientMessage(playerid, COLOR_GREEN, "You've Earnt $%d");
The give random money works perfectly fine, i just need it to say you're earnt %d


Thanks in advance
Reply
#2

You need to create an array to use as a string, and format it:

pawn Код:
new money = random(10000-5000)+5000;
GivePlayerMoney(playerid, money);

new string[128];
format(string, sizeof(string), "You've Earnt $%d", money);
SendClientMessage(playerid, COLOR_GREEN, string);
Reply
#3

Quote:
Originally Posted by Zamaroht
Посмотреть сообщение
You need to create an array to use as a string, and format it:

pawn Код:
new money = random(10000-5000)+5000;
GivePlayerMoney(playerid, money);

new string[128];
format(string, sizeof(string), "You've Earnt $%d", money);
SendClientMessage(playerid, COLOR_GREEN, string);
Here is a little #define we use in my server that makes this vastly easier:

pawn Код:
stock bool:False = false;
#define SendClientMessageFormatted(%0,%1,%2,%3) do{new str[128];format(str,sizeof(str),(%2),%3);SendClientMessage((%0),(%1),str);}while(False)

// Example
SendClientMessageFormatted(playerid, COLOR_GREEN, "You've Earned $%d", money);
Reply
#4

just folow the way they give you dude i have maked my own rcon admin script like this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)