help with forum name command pls
#1

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
Reply
#2

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.
Reply
#3

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)
Reply
#4

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

Make sure MySQL is saving it as a string.
Reply
#6

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.
Reply
#7

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);
Reply
#8

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] ?
Reply
#9

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".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)