SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 18/06/2012, 03:28 PM   #1
A7X_CEEJAY
Big Clucker
 
Join Date: Jan 2011
Posts: 108
Reputation: 4
Default Formating a message?

Hello, I need a bit of help changing the 'target audience' of my messages.

pawn Code:
if(IsPlayerLoggedIn(playerid)) {SaveChar(playerid);}
    if(LogMessage == 1)
    {
    switch(reason)
    {
        case 0: format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Timeout)", RPN(playerid));
        case 1: format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Leaving)", RPN(playerid));
        case 2: format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Kicked/Banned)", RPN(playerid));
    }
    Log("logs/joinleave.log", string);
    }
    else if(LogMessage == 0)
    {
    return 1;
    }

You see where it says case 0: - I want that to basically only be sent to admins.

My admin message 'line' is (Example)
pawn Code:
SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);}

I tried doing;
pawn Code:
case 0: format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Timeout)", RPN(playerid));
SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
case 1: format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Leaving)", RPN(playerid));
SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
case 2: format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Kicked/Banned)", RPN(playerid));
SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
and
pawn Code:
}
Log("logs/joinleave.log", string);
SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
}
else if(LogMessage == 0)
But it failed to work, any ideas?

(Errors:
pawn Code:
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2953) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2953) : warning 215: expression has no effect
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2954) : error 014: invalid statement; not in switch
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2954) : warning 215: expression has no effect
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2954) : error 001: expected token: ";", but found ":"
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2954) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\zGamingRoleplay\zGamingRoleplay\gamemodes\ZRP.pwn(2954) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
__________________

Click the banner to add to favorites
FUTURE GAMING ROLEPLAY - 184.22.57.202:7777
A7X_CEEJAY is offline   Reply With Quote
Old 18/06/2012, 03:36 PM   #2
Drebin
High-roller
 
Drebin's Avatar
 
Join Date: Oct 2010
Location: Germany
Posts: 1,137
Reputation: 513
Default AW: Formating a message?

pawn Code:
case 0:
{
    format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Timeout)", RPN(playerid));
    SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
}
case 1:
{
    format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Leaving)", RPN(playerid));
    SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
}
case 2:
{
    format(string, sizeof(string), "*[%d:%d:%d] %s has left the server. (Kicked/Banned)", RPN(playerid));
    SendAdminMessage(COLOR_ADMINMESSAGE, 1, string);
}
Drebin is offline   Reply With Quote
Old 18/06/2012, 03:42 PM   #3
A7X_CEEJAY
Big Clucker
 
Join Date: Jan 2011
Posts: 108
Reputation: 4
Default Re: Formating a message?

I shall try such, and give rep if it works :3

EDIT: It worked, + Rep given. Thankyou :3

+ Something new learned XD
__________________

Click the banner to add to favorites
FUTURE GAMING ROLEPLAY - 184.22.57.202:7777
A7X_CEEJAY is offline   Reply With Quote
Reply

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
Dini formating wrong? Blunt P Scripting Help 2 02/03/2012 05:00 PM
formating dialog ajwar Help Archive 1 13/08/2011 09:53 AM
Formating MySQL Raimis_R Help Archive 4 18/11/2010 03:46 PM
formating a random 3d label WillyP Help Archive 2 30/10/2010 11:34 AM
Dialog and formating text Doman Help Archive 5 19/05/2010 07:37 PM


All times are GMT. The time now is 05:41 AM.


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