Not saving reason and admin name
#1

Hey!

So I'm trying to save ban details to playerdata. I made this under player data
{
pBanAdmin[256],
pBanReason[128],
}

and this under ban command
{
pInfo[pID][pBanAdmin] = pInfo[playerid][pName];
pInfo[pID][pBanReason] = reason[64];
}

and I used print for debugging and it gives me this.. Im trying to fix this for quite some time now.. please help if anyone knows..

https://i.gyazo.com/0a8b894e7dda1352...cd5521fdb1.png
Reply
#2

Post here your ban command. Nobody will help you in this case because nobody know what the hell you are saying!
Reply
#3

Sorry.. https://pastebin.com/F90AT9s8
Reply
#4

U need to get players name first to store it:

Код:
#define GetName(%0) Name[%0]
At the top of your code.

Then u can use GetName(playerid) any time.

The problem is u are trying to save STRING, not only numbers.
So you need to open players ini file first and store your information as string!

Код:
new 
                INI:File = INI_Open(User(playerid));
                INI_SetTag(File,"BanData");
                INI_WriteString(File,"Name",(GetName(playerid));
                INI_WriteString(File,"Reason",(reason));
		INI_Close(File);
IAM NOOB MAYBE IAM WRONG AND I HOPE SOMEONE WILL HELP YOU BETTER WAY!
Reply
#5

I already have the playerdata to getplayername

GetPlayerName(playerid, pInfo[playerid][pName], MAX_PLAYER_NAME); under OnPlayerConnect

and im using MySQL not INI
Reply
#6

pawn Код:
strcpy(pInfo[pID][pBanAdmin], pInfo[playerid][pName], MAX_PLAYER_NAME);
pInfo[pID][pBanReason] = reason;
Need to use strcpy if copying string from enum.

You also need this if you don't have strcpy:

pawn Код:
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
    return strmid(dest, source, 0, maxlength, maxlength);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)