PDA

View Full Version : VIP chat


thimo
25/11/2011, 04:48 PM
Well, i wanted to make a vip chat, but if i use it wont work.. what am i doing wrong in this code?

if( text [ 0 ] == '!')
{
for (new i; i < MAX_PLAYERS; i++)
{
if(APlayerData[i][EtMemberShip] == 1)
{
new string[ 128 ];
GetPlayerName( playerid , string , sizeof( string ));

if(APlayerData[i][EtMemberShip] == 1)
{
format( string , sizeof( string ) , " Vip Chat: {FC0303}%s{FFFFFF}: {00CEFC}%s" , string , text[ 1 ] ) ;
SendClientMessage(i, 0xFFFFFFF , string ) ;
}
}
}

return 0 ;


Thanks!

HyperZ
25/11/2011, 04:52 PM
if( (text[0] == '!') && strlen(text) > 1)
{
new str[128];
new szPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

if(APlayerData[playerid][EtMemberShip] == 1)
{
format( str , sizeof( str ) , " Vip Chat: {FC0303}%s{FFFFFF}: {00CEFC}%s" , szPlayerName , text[ 1 ] ) ;

for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
{
if(!IsPlayerConnected(iPlayerID)) continue;
if(APlayerData[iPlayerID][EtMemberShip] == 1) continue;
SendClientMessage(iPlayerID, 0xFFFFFFF, str);
}
}

return 0;
}

thimo
25/11/2011, 06:17 PM
This doesnt work at all please help!?

iPLEOMAX
25/11/2011, 06:40 PM
public OnPlayerText(playerid, text[])
{
if (text[0] == '!')
{
if (APlayerData[playerid][EtMemberShip] < 1)
{
SendClientMessage(playerid, -1, "Sorry, you cannot use the VIP Chat.");
return false;
}

new VIPMessage[128];
GetPlayerName(playerid, VIPMessage, MAX_PLAYER_NAME);
format(VIPMessage , sizeof VIPMessage, "VIP Chat: {FC0303}%s{FFFFFF}: {00CEFC}%s" , VIPMessage, text[1]);

for (new i; i<MAX_PLAYERS; i++)
{
if (!IsPlayerConnected(i)) continue;
if (APlayerData[i][EtMemberShip] < 1) continue;
SendClientMessage(i, -1, VIPMessage);
}

return false;
}
return true;
}

Untested.

thimo
26/11/2011, 07:33 AM
I already fixed myself the problem was the loop didnt go further then id 0; so i putted in continue :)