SA-MP Forums Archive
Not saving reason and admin name - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Not saving reason and admin name (/showthread.php?tid=651346)



Not saving reason and admin name - NoteND - 18.03.2018

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


Re: Not saving reason and admin name - ThomasEvil - 18.03.2018

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


Re: Not saving reason and admin name - NoteND - 18.03.2018

Sorry.. https://pastebin.com/F90AT9s8


Re: Not saving reason and admin name - ThomasEvil - 18.03.2018

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!


Re: Not saving reason and admin name - NoteND - 18.03.2018

I already have the playerdata to getplayername

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

and im using MySQL not INI


Re: Not saving reason and admin name - MadeMan - 18.03.2018

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);
}