Problem at the beginning of writing code
#1

Hello, I am new in programming and I have first problem. I write simply thing that will give player money on spawn with some text with it but it doesn't work.. Please help!



https://pastebin.com/AhcGJkhM
Reply
#2

It works!

I've tested it. Can you check again? Maybe you have misspelled game mode name.

EDIT: You don't have to use getplayername to get player's name. There is a correct way to do it.
Код HTML:
public OnPlayerSpawn(playerid)
{
    new Player_Name[MAX_PLAYER_NAME];
    GivePlayerMoney(playerid, START_MONEY);

    new string[64];
    format(string, sizeof(string), "Welcome %s, take that $500 for start!", Player_Name);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    return 1;
}
Reply
#3

The code is clean and should work
Reply
#4

Change this:

Код:
format(string, sizeof(string), "Welcome %s, take that $500 for start!", Player_Name);
To this:

Код:
format(string, sizeof(string), "Welcome %s, take that $%d for start!", Player_Name, START_MONEY);
Now your start money value is totally dynamic.
Reply
#5

I have correct gamemod in cfg, what else could be wrong? :/ Code works only on server console but not in game.
Reply
#6

It's working for me
Reply
#7

Um a bit weird question but have you compiled your gamemode?
Reply
#8

Quote:
Originally Posted by Fratello
Посмотреть сообщение
Um a bit weird question but have you compiled your gamemode?
Yes No errors there, and loading correct map that I am editing.
Reply
#9

Compile it with pawno
Reply
#10

Quote:
Originally Posted by Fratello
Посмотреть сообщение
It works!

I've tested it. Can you check again? Maybe you have misspelled game mode name.

EDIT: You don't have to use getplayername to get player's name. There is a correct way to do it.
Код HTML:
public OnPlayerSpawn(playerid)
{
    new Player_Name[MAX_PLAYER_NAME];
    GivePlayerMoney(playerid, START_MONEY);

    new string[64];
    format(string, sizeof(string), "Welcome %s, take that $500 for start!", Player_Name);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    return 1;
}
Are you stupid or just stupid?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)