Raised This Month: $ Target: $400
 0% 

Making a new function [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 07-27-2008 , 17:20   Making a new function [SOLVED]
Reply With Quote #1

Ok this is gonna sound really nubbish, but its the best i can explain what i want to do

Basiaclly i need to make a new function like client_print but make some of it green
I have made it, and it almost works, but i need to know how you make it so you can use 2 arguments, but in some cases you can use the 3rd aswell
Code:
stock green_print(index, const message[], const message2[])
{
    new finalmsg[192];
    formatex(finalmsg, 191, "^x04%s ^x01%s", g_tag, message);
    message_begin(MSG_ONE, SayText, _, index);
    write_byte(index);
    write_string(finalmsg);
    message_end();
}
index would be a players index
const message[] is a constant message which is shown to all players
const message2[] is an optional bit

E.g. using 3 arguments
green_print(id, "Hello %s", g_tag)

E.g. using 2 arguments
green_print(id, Hello everyone!")

Again apologies for the nubbishness ;)

This has been solved by X-olent
Thanks a bunch man!
__________________

Last edited by minimiller; 07-28-2008 at 07:55. Reason: [SOLVED]
minimiller is offline
Send a message via MSN to minimiller
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-27-2008 , 18:43   Re: [help] Making a new function
Reply With Quote #2

Code:
stock green_print(index, const fmt[], any:...)
{
    new message[192];
    vformat(message, 191, fmt, 3);
    
    new finalmsg[192];
    formatex(finalmsg, 191, "^x04%s ^x01%s", g_tag, message);
    message_begin(MSG_ONE, SayText, _, index);
    write_byte(index);
    write_string(finalmsg);
    message_end();
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 05:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode