Error With Dini
#1

pawn Код:
new file[256]; format(file,sizeof(file),"Roleplay/Users/%s.ini",pName(playerid));
The errors
Quote:

C:\Users\Grand\Desktop\Ultimate Gaming Ground\gamemodes\RolePlayByME.pwn(165) : error 012: invalid function call, not a valid address
C:\Users\Grand\Desktop\Ultimate Gaming Ground\gamemodes\RolePlayByME.pwn(165) : warning 215: expression has no effect
C:\Users\Grand\Desktop\Ultimate Gaming Ground\gamemodes\RolePlayByME.pwn(165) : error 001: expected token: ";", but found ")"
C:\Users\Grand\Desktop\Ultimate Gaming Ground\gamemodes\RolePlayByME.pwn(165) : error 029: invalid expression, assumed zero
C:\Users\Grand\Desktop\Ultimate Gaming Ground\gamemodes\RolePlayByME.pwn(165) : 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
#2

What's that pName(playerid)? stock function?
Reply
#3

pawn Код:
stock pName(playerid)
{
    new string[24];
    GetPlayerName(playerid,string,24);
    return string;
}
Yup aha but I'm using this
pawn Код:
new pName[MAX_PLAYER_NAME+1];
Reply
#4

You can't have a variable and a function with the same name, evidently.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
You can't have a variable and a function with the same name, evidently.
What do you mean that PName?
I'm not using the stock. I'm using the new pName[MAX_PLAYER_NAME+1];
Reply
#6

So pName is not a variable, you don't need that "new pName[maxplayers]" line. And this is your stock:
pawn Код:
stock pName(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),"Roleplay/Users/%s.ini",playername);
    return string;
}
Reply
#7

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
So pName is not a variable, you don't need that "new pName[maxplayers]" line. And this is your stock:
pawn Код:
stock pName(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),"Roleplay/Users/%s.ini",playername);
    return string;
}
Ahh Thank You could you explain to me why that worked?
I had this stock function like
/* so it don't work Anyways why does it work like this?

Btw im using this version
pawn Код:
stock pName(playerid)
{
    new string[24];
    GetPlayerName(playerid,string,24);
    return string;
}
Reply
#8

Oh, I use this stock cause with y_ini you need to open the file. But with dini you dont open/close files. So I suppose you don;t need my stock. All you need is to get the player's .ini file, so stick to your stock. Just remove that line as I said before.
Reply
#9

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
Oh, I use this stock cause with y_ini you need to open the file. But with dini you dont open/close files. So I suppose you don;t need my stock. All you need is to get the player's .ini file, so stick to your stock. Just remove that line as I said before.
Okay thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)