VIP chat help... how to make it so ... [Readdd]
#1

fixed dont reply
Reply
#2

pawn Код:
CMD:vip(playerid, params[])
{
    new string[128],name[24];
    if (gPlayerData[playerid][VIP] < 1) return SendClientMessage(playerid, -1, "Sorry, you cannot use the this Chat. Please Donate first.");
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error. Correct usage: /vip [text]");
    GetPlayerName(playerid,name,24);
    format( string, sizeof( string ),"V.I.P Chat: {00FF00}%s(%d){FF5500}: %s",name playerid,params);
    for(new a=0;a<MAX_PLAYERS;a++) if(IsPlayerConnected(a) && gPlayerData[playerid][VIP] >= 1) SendClientMessage(a,-1,string);
    return 1;
}
UNTESTED!
Reply
#3

Dimi's command did the job, but it did not work like the first one, maybe it was even re-written, you feel free to use my version (which is also flawless).

pawn Код:
CMD:vip( playerid, params[ ] )
{
    if (gPlayerData[playerid][VIP] >= 1)
    {
        new string[128];
        if( isnull( params ) ) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error. Correct usage: /vip [text]");
        format( string, sizeof( string ),"V.I.P Chat: {00FF00}%s{FF5500}: %s", playerid, pText );
        foreach(Player,i) // for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if ( gPlayerData[i][VIP] >= 1 )
            {
                SendclientMessage( i , -1, string );
            }
        }
       
    }
    else if (gPlayerData[playerid][VIP] < 1)
    {
        SendClientMessage(playerid, -1, "Sorry, you cannot use the this Chat. Please Donate first.");
        return 1;
    }

    return 1;
}
Reply
#4

just pm'd you but your command also have some errors in, ive fixed some but others idk,

SAMP\filterscripts\EcRegisterLogin.pwn(722) : error 017: undefined symbol "foreach"
foreach(Player,i) // for(new i = 0; i < MAX_PLAYERS; i++)
SAMP\filterscripts\EcRegisterLogin.pwn(724) : error 017: undefined symbol "i"
if ( gPlayerData[i][VIP] >= 1 )
SAMP\filterscripts\EcRegisterLogin.pwn(726) : error 017: undefined symbol "SendclientMessage"
SendclientMessage( i , -1, string );
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#5

Do you have the 'Foreach' included?
Код:
#include <foreach>
Error: Undefined Symbol - SendclientMessage
Error: Undefined Symbol - i

Change: SendclientMessage
to: SendClientMessage
Reply
#6

SAMP\filterscripts\EcRegisterLogin.pwn(722) : error 017: undefined symbol "foreach"
pawn Код:
// At The Top
#include <foreach>
Edit: User above was faster.
Reply
#7

If you dont have Foreach, Use admantis's cmd with the loop instead of foreach,which is a seperate include.
Код:
CMD:vip( playerid, params[ ] )
{
    if (gPlayerData[playerid][VIP] >= 1)
    {
        new string[128];
        if( isnull( params ) ) return SendClientMessage(playerid, 0xFFFFFFF,"Syntax error. Correct usage: /vip [text]");
        format( string, sizeof( string ),"V.I.P Chat: {00FF00}%s{FF5500}: %s", playerid, pText );
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if ( gPlayerData[i][VIP] >= 1 )
            {
                SendClientMessage( i , -1, string );
            }
        }
       
    }
    else if (gPlayerData[playerid][VIP] < 1)
    {
        SendClientMessage(playerid, -1, "Sorry, you cannot use the this Chat. Please Donate first.");
        return 1;
    }

    return 1;
}
Im pretty sure that should work
Reply
#8

I'm sorry about the SendclientMessage it's capitalization mistake..

Use:
Код:
SendClientMessage( i , -1, string );
Reply
#9

EDIT: This wasn't meant to be posted :S It was meant to be my signature :O
Reply
#10

ok i fixed the errors but when i type in the vip chat like for example:

/vip testing if this works

nothing will show up after "V.I.P Chat:"


??


EDIT: this is the current code :

PHP код:

CMD
:vipplayeridparams[ ] )
{
    if (
gPlayerData[playerid][VIP] >= 1)
    {
        new 
string[128], pText[128];
        if( 
isnullparams ) ) return SendClientMessage(playerid0xFFFFFFF,"Syntax error. Correct usage: /vip [text]");
        
formatstringsizeof( string ),"V.I.P Chat: {00FF00}%s{FF5500}: %s"playeridpText );
        foreach(
Player,i// for(new i = 0; i < MAX_PLAYERS; i++)
        
{
            if ( 
gPlayerData[i][VIP] >= )
            {
                
SendClientMessage , -1string );
            }
        }
    }
    else if (
gPlayerData[playerid][VIP] < 1)
    {
        
SendClientMessage(playerid, -1"Sorry, you cannot use the this Chat. Please Donate first.");
        return 
1;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)