SA-MP Forums Archive
help with forum name command pls - 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: help with forum name command pls (/showthread.php?tid=651637)



help with forum name command pls - Zeus666 - 24.03.2018

PHP код:
CMD:forumname(playerid,params[])
{
    if(
pInfo[playerid][pAdminLevel] >= 2)
    {
        new 
targetid,FName[24],string[128];
        if(
sscanf(params"us[105]"targetid,FName)) return SendClientMessage(playerid,COLOR_LIGHTBLUE"CMD: /ForumName [PlayerID] [Nume]");
           if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Acest player nu este online !");
        
pInfo[targetid][ForumName] = FName;
        
SaveStats(targetid);
        
format(string,sizeof(string),"*"COL_RED" %s %s has set %s's  forum name into %s"GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),FName);
        
SendClientMessageToAll(-1,string);
        
format(string,sizeof(string),"*"COL_RED" %s %s has set your FName to %s",GetAdminName(playerid), PlayerName(playerid),FName);
        
SendClientMessage(targetid,-1,string);
    }
    else {
        
SendClientMessage(playerid,-1,"*"COL_RED" You no admin!");
    }
    return 
1;

If I set my forumname into Elmer Fudd, at first it sets fine, but at relog it shows only "E"


PHP код:
enum playerinfo
{
    
ForumName[24],
 `
ForumNamevarchar(24NOT NULL,
               
cache_get_field_content(0"ForumName"tmp), pInfo[playerid][ForumName] = strval(tmp); 
why


Re: help with forum name command pls - jasperschellekens - 24.03.2018

Don't save all stats like this. This could drastically lag your server.
Just use a query inside the command which only changes the forum name.
Please show us the query you use to set the forum name.


Re: help with forum name command pls - Zeus666 - 24.03.2018

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Don't save all stats like this. This could drastically lag your server.
Just use a query inside the command which only changes the forum name.
Please show us the query you use to set the forum name.
I set it via forumname command (if i understand correctly)


Re: help with forum name command pls - jasperschellekens - 24.03.2018

I dont see a query in your command.
I think its in SaveStats(targetid);
Show me the query


Re: help with forum name command pls - Infin1ty - 24.03.2018

Make sure MySQL is saving it as a string.


Re: help with forum name command pls - Zeus666 - 24.03.2018

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
I dont see a query in your command.
I think its in SaveStats(targetid);
Show me the query
Doesn't work, tried to fix it.


1) In Game, when you type /forumname it sets in mysql database as varchar.
2) When you relog, in mysql still is varchat
3) When you enter back to server, it is still varchar, but in /forumname it shows blank (as 0) it won't read it.


Re: help with forum name command pls - Grim_ - 25.03.2018

pawn Код:
pInfo[playerid][ForumName]*=*strval(tmp);*
? You are trying to return an integral value from a string that holds a name.

You should empty the string then assign the value by strcat
pawn Код:
pInfo[playerid][ForumName][0] = EOS;
strcat(pInfo[playerid][ForumName], tmp);



Re: help with forum name command pls - Zeus666 - 25.03.2018

Quote:
Originally Posted by Grim_
Посмотреть сообщение
pawn Код:
pInfo[playerid][ForumName]*=*strval(tmp);*
? You are trying to return an integral value from a string that holds a name.

You should empty the string then assign the value by strcat
pawn Код:
pInfo[playerid][ForumName][0] = EOS;
strcat(pInfo[playerid][ForumName], tmp);
where should I put those? and why [0] ?


Re: help with forum name command pls - Grim_ - 25.03.2018

In my last reply, replace that line of code with those lines of code.
pawn Код:
pInfo[playerid][ForumName][0] = EOS
That sets the first cell to '\0' or "End-Of-String".