Hmmm... Help.. please
#1

I made a Gang System.. And To make a gang you half to create so It shows them a dialog input box And they type the name Well the name is stored into the users ini file but Some reason It stores it as a string length in like Gang = 16 Here the code..

pawn Код:
this in the dialog response
GangName(playerid, strlen(inputtext));

this in its own public

public GangName(playerid, Gang)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), ARS_ACCOUNTS, name);
    PlayerInfo[playerid][pGang] = Gang;
    dini_IntSet(file, "Gang",PlayerInfo[playerid][pGang]);
    return 1;
}
When gang is created i tried Test Of Testicles the outcome in the userfile Was Gang = 17
Reply
#2

Man I need some scripting FRIENDS!!
Reply
#3

Show us your "enum"
Reply
#4

dini_IntSet(file, "Gang",PlayerInfo[playerid][pGang]);

That's not correct. "dini_IntSet" is for setting values (integer). If you try to save a string it ends up as a random value.

Use "dini_Set", this saves the actual GangName string.
Reply
#5

Why are you using strlen function? This returns the lenght of the string is that what you need?

pawn Код:
GangName(playerid, strlen(inputtext));
Reply
#6

If you are trying to save the string:


pawn Код:
//Change this part in your enum:
pGang to pGang[25]

//Under OnDialogResponse:
if(strlen(inputtext) > 24 || strlen(inputtext) < 5) return SendClientMessage(playerid, -1, "Use a name with 5 - 24 characters.");
GangName(playerid, inputtext);

public GangName(playerid, Gang[])
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), ARS_ACCOUNTS, name);
    format(PlayerInfo[playerid][pGang], 25, Gang);
    dini_Set(file, "Gang", Gang);
    return 1;
}
Not tested.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)