SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 17/03/2010, 04:41 PM   #1
Desert
Big Clucker
 
Join Date: Aug 2009
Location: Denmark
Posts: 197
Reputation: 0
Default Minor problem

Hey i made an ooc command which looks like this

pawn Code:
dcmd_ooc(playerid,params[])
{
    new text,name[MAX_PLAYER_NAME],string[128];
    if(sscanf(params,"s",text)) SendClientMessage(playerid,COLOUR_RED,"Usage: /ooc message");
    else
    {
        GetPlayerName(playerid,name,sizeof(name));
        format(string,sizeof(string),"OOC %s: %s",name,text);
        SendClientMessageToAll(COLOUR_WHITE,string);
        }
    return 1;
}

Which works fine exept it sends the text plus an "SERVER: Unknown command" no matter where i put the return 1; Any ideas?
Desert is offline  
Old 17/03/2010, 04:50 PM   #2
Correlli
Godfather
 
Correlli's Avatar
 
Join Date: May 2009
Posts: 7,032
Reputation: 103
Default Re: Minor problem

You should return the message ( return SendClientMessage(...); ).
Correlli is offline  
Old 17/03/2010, 05:15 PM   #3
Desert
Big Clucker
 
Join Date: Aug 2009
Location: Denmark
Posts: 197
Reputation: 0
Default Re: Minor problem

Had no effect.

Even tried return both messages
Desert is offline  
Old 17/03/2010, 06:06 PM   #4
PowerSurge
Little Clucker
 
Join Date: Feb 2009
Posts: 37
Reputation: 0
Default Re: Minor problem

pawn Code:
dcmd_ooc(playerid, params[])
    {
    new sendername[32];
    new idx;
    new string[128];

    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(params);
    while ((idx < length) && (params[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = params[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
    return 1;
    }
    format(string, sizeof(string), "OOC [%d]%s: %s", playerid, sendername, result);
    SendClientMessageToAll(COLOR_WHITE,string);
    printf("%s", string);
    return 1;
    }
PowerSurge is offline  
Old 17/03/2010, 06:24 PM   #5
Desert
Big Clucker
 
Join Date: Aug 2009
Location: Denmark
Posts: 197
Reputation: 0
Default Re: Minor problem

Thanks worked
Desert is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very minor countdown problem [XST]O_x Help Archive 2 10/07/2010 03:58 PM
Minor Problem Please Help Typical_Cat Help Archive 2 27/04/2010 08:08 AM
Payday, minor help. Perker12345 Help Archive 1 30/01/2010 04:37 AM
Minor problem with DCMD set skin command MisterTickle Help Archive 2 16/01/2010 10:51 AM
[NPC] Minor problem with my npc Pawno_Master Help Archive 5 25/10/2009 07:05 AM


All times are GMT. The time now is 08:45 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.