What Is Wrong In It
#1

Код:
new string[ 300 ];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    SM0 = TextDrawCreate(280.000091, 193.386627, "~w~Welcome To~g~San Fierro ~b~%s");
TextDrawLetterSize(SM0, 0.491600, 1.749333);
TextDrawAlignment(SM0, 2);
TextDrawColor(SM0, -1);
TextDrawSetShadow(SM0, 0);
TextDrawSetOutline(SM0, 1);
TextDrawBackgroundColor(SM0, 51);
TextDrawFont(SM0, 3);
TextDrawSetProportional(SM0, 1);

SM1 = TextDrawCreate(321.599914, 211.306549, "~w~Type ~y~/help ~y~/rules ~w~or ~y~/cmds ~w~for game info");
TextDrawLetterSize(SM1, 0.334000, 1.368533);
TextDrawAlignment(SM1, 2);
TextDrawColor(SM1, -1);
TextDrawSetShadow(SM1, 0);
TextDrawSetOutline(SM1, 1);
TextDrawBackgroundColor(SM1, 51);
TextDrawFont(SM1, 3);
TextDrawSetProportional(SM1, 1);
errors
Код:
C:\Users\Anurag\Desktop\Most Wanted Cops and Robbers v1.1\gamemodes\MWCNR.pwn(2719) : error 017: undefined symbol "playerid"
C:\Users\Anurag\Desktop\Most Wanted Cops and Robbers v1.1\gamemodes\MWCNR.pwn(2739) : error 021: symbol already defined: "string"
Error line
Код:
   GetPlayerName(playerid, pName, sizeof(pName));
Reply
#2

Hello!

I think this code is in the callback OnGameModeInit and there doesn't exist "playerid".
So, you have to create this textdraw there and update the text in another callback.

In OnGameModeInit:
PHP код:
SM0 TextDrawCreate(280.000091193.386627"~w~Welcome To~g~San Fierro ~b~%s");
TextDrawLetterSize(SM00.4916001.749333);
TextDrawAlignment(SM02);
TextDrawColor(SM0, -1);
TextDrawSetShadow(SM00);
TextDrawSetOutline(SM01);
TextDrawBackgroundColor(SM051);
TextDrawFont(SM03);
TextDrawSetProportional(SM01);
SM1 TextDrawCreate(321.599914211.306549"~w~Type ~y~/help ~y~/rules ~w~or ~y~/cmds ~w~for game info");
TextDrawLetterSize(SM10.3340001.368533);
TextDrawAlignment(SM12);
TextDrawColor(SM1, -1);
TextDrawSetShadow(SM10);
TextDrawSetOutline(SM11);
TextDrawBackgroundColor(SM151);
TextDrawFont(SM13);
TextDrawSetProportional(SM11); 
In OnPlayerConnect:
PHP код:
new string300 ];
new 
pName[MAX_PLAYER_NAME];
GetPlayerName(playeridpNamesizeof(pName));
format(string,sizeof(string),"~w~Welcome to~g~ San Fierro ~b~%s",pName);
TextDrawShowForPlayer(playerid,SM0);
TextDrawSetString(SM0,string); 
Tip:
You will update the text with the name so you should use player textdraws (https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw). So each player can see his / her own name.
If you use the global textdraws each connected player will see the name of the last connected player.
I hope it's understandable.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)