Cant figure out Function
#1

SetPlayerName(playerid, "Firstname",file[playerid][pFirstname]);
This wont work ^



SetPlayerName(playerid, "Firstname");
This just sets the name to Firstname
I need it to retrieve a Certain name from this file area ..
the name has been created and is saved in userfiles but here how i get files form user files

new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_SERVERFILES, name);

Any have any suggestions thanks
Reply
#2

You aren't using the function correctly, which is obvious.

pawn Code:
SetPlayerName(playerid, file[playerid][pFirstname]);
Reply
#3

Quote:
Originally Posted by RealCop228
View Post
You aren't using the function correctly, which is obvious.

pawn Code:
SetPlayerName(playerid, file[playerid][pFirstname]);
Thanks for the reply RealCop but got errors

Code:
Desktop\ARS0~1.2\GAMEMO~1\ARS.pwn(1311) : error 001: expected token: ",", but found "["
Desktop\ARS0~1.2\GAMEMO~1\ARS.pwn(1311) : error 029: invalid expression, assumed zero
Desktop\ARS0~1.2\GAMEMO~1\ARS.pwn(1311) : warning 215: expression has no effect
Desktop\ARS0~1.2\GAMEMO~1\ARS.pwn(1311) : error 001: expected token: ";", but found "]"
Desktop\ARS0~1.2\GAMEMO~1\ARS.pwn(1311) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

What do you have on line 1311...?
Reply
#5

pawn Code:
public OnPlayerSpawn(playerid)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), ARS_SERVERFILES, name);
    SetPlayerColor(playerid, WHITE );
    if(gPlayerLogged[playerid] == 0)
    {
        SendClientMessage(playerid, RED, "This server requires a Login before spawn");
        Kick(playerid);
    }
    SetPlayerName(playerid, file[playerid][pFirstname])); // Line 1311
    SetPlayerSkin(playerid, dini_Int(file, "Character"));
    SetPlayerPos(playerid, dini_Float(file, "LocX"),dini_Float(file,"LocY"),dini_Float(file,"LocZ"));
    SetPlayerFacingAngle(playerid,dini_Float(file,"LocA"));
    SetPlayerInterior(playerid,dini_Int(file,"LocI"));

    NameText[playerid] = TextDrawCreate(86.000000, 332.000000, " ");
    TextDrawBackgroundColor(NameText[playerid], 255);
    TextDrawAlignment(NameText[playerid], 2);
    TextDrawFont(NameText[playerid], 0);
    TextDrawLetterSize(NameText[playerid], 0.469999, 1.299999);
    TextDrawColor(NameText[playerid], ORANGE);
    TextDrawSetOutline(NameText[playerid], 1);
    TextDrawSetProportional(NameText[playerid], 1);
    SetTimerEx("SetTextdraw", 2000, false, "i", playerid);
    return 1;
}
Reply
#6

Why do you have two )'s?

pawn Code:
SetPlayerName(playerid, file[playerid][pFirstname]); // Line 1311
Reply
#7

Because i was trying to figure it out but got more errors hehe but ur comment was that error i showed above..
Reply
#8

Does this;
pawn Code:
file[playerid][pFirstname]
even have a value, or exist in your script?
Reply
#9

Um yes but using enum

pawn Code:
enum pInfo
{
    pAccount,
    pFirstname,
    pLastname,
    pAge,
    pGender,
    pCharacter,
    pAdminLevel,
    pCash,
    pScore,
    pReg,
    pId,
    pHealth,
    pArmour,
    pLocX,
    pLocY,
    pLocZ,
    pLocA,
    pLocI,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#10

Then instead of this;
pawn Code:
file[playerid][pFirstname]
it should be this;
pawn Code:
PlayerInfo[playerid][pFirstname]
Reply
#11

Well that sucked It crashed the server on spawn with this code.

Код:
SetPlayerName(playerid,PlayerInfo[playerid][pFirstname]);
Reply
#12

Quote:
Originally Posted by Buzzbomb
Посмотреть сообщение
Well that sucked It crashed the server on spawn with this code.

Код:
SetPlayerName(playerid,PlayerInfo[playerid][pFirstname]);
You must have nothing assigned to that variable then.
Reply
#13

Do you have msn if so Please add me il show you the whole mode not huge no worries...

holyschytt@live.com
Reply
#14

Quote:
Originally Posted by Buzzbomb
Посмотреть сообщение
Do you have msn if so Please add me il show you the whole mode not huge no worries...

holyschytt@live.com
Just upload it to Pastebin or something and PM me the link.
Reply
#15

Um done uploaded it ... you get my pm
Reply
#16

Man i really want this .. i hate simple codes that seem to be the hardest grr......
Reply
#17

Can Anyone please review this post and give me some pointers and not wiki i searched it but something that might work
Reply
#18

Are you setting the player's name to a variable instead of a string?
Reply
#19

That's an integer, it's current value is 2.

What you want is a string
Код:
pFirstName[size_here],
Can't remember how it handles them in Pawn but IIRC they run incremental top to bottom so if you add a string the next enum value will be "last + size-of-string + 1".
Reply
#20

Um yes its set to a variable and if i add a string i hope the hell dont mess up but here a link where i posted this pain hehe i figured i share a working login and register system that saved stats and locations and skins but if you guys wanna pawn it and give it a shot and if it works ur way tell me

https://sampforum.blast.hk/showthread.php?tid=192305

but ill go ahead and try your ideals..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)