PDA

View Full Version : Help sendclientmessagetoall


kbalor
27/09/2013, 03:35 PM
Help I want to send a message to all if a player admin or vip has been logged in.

Sample: "Poccahontas (ID:4) | Moderator - has been logged in the server.
or Sample: "Mojaco (ID:2) | VIP- Silver - has been logged in the server."


Looking forward to hear your reply.

Here is the code: if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] > 0)
{
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Vip : %s",VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] == 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s",Account[playerid][Level],ARank);
SendClientMessage(playerid,COLOR_LBLUE,str);
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] > 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s - Vip : %s",Account[playerid][Level],ARank,VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
}
else if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] == 0)
{
format(str,128,"{33CC33}>> You have been Automatically Logged in!");
SendClientMessage(playerid,COLOR_LBLUE,str);
}
}

arakuta
27/09/2013, 03:48 PM
Check if the player is a admin or a vip, then fomat a texts with the desired information, then send to all.

kbalor
27/09/2013, 04:22 PM
Check if the player is a admin or a vip, then fomat a texts with the desired information, then send to all.

Hi. Thank you for your answer. But I would also like to ask if you can make a simple demo to the script that I post?

Tosfera
27/09/2013, 04:34 PM
I'm new to samp so if I'm saying something that is entirely stupid, just ignore me.

Why don't you just create a loop ( foreach ) that's looking for every single object with the data 'player' ( loop trough all the players ), and if the name isn't the name of the one that logged in, output a message to the player which is being looped at that moment.

Konstantinos
27/09/2013, 04:38 PM
Replace my messages to the format function and uncommend the SendClientMessageToAll function.
if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] > 0)
{
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Vip : %s",VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
// FORMAT THE MESSAGE YOU WANT FOR VIPS
// format( ... );
// SendClientMessageToAll( -1, str );
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] == 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s",Account[playerid][Level],ARank);
SendClientMessage(playerid,COLOR_LBLUE,str);
// FORMAT THE MESSAGE YOU WANT FOR ADMINS
// format( ... );
// SendClientMessageToAll( -1, str );
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] > 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s - Vip : %s",Account[playerid][Level],ARank,VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
// FORMAT THE MESSAGE YOU WANT FOR ADMINS AND VIPS
// format( ... );
// SendClientMessageToAll( -1, str );
}
else if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] == 0)
{
format(str,128,"{33CC33}>> You have been Automatically Logged in!");
SendClientMessage(playerid,COLOR_LBLUE,str);
}

kbalor
27/09/2013, 08:00 PM
Replace my messages to the format function and uncommend the SendClientMessageToAll function.
if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] > 0)
{
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Vip : %s",VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
// FORMAT THE MESSAGE YOU WANT FOR VIPS
// format( ... );
// SendClientMessageToAll( -1, str );
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] == 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s",Account[playerid][Level],ARank);
SendClientMessage(playerid,COLOR_LBLUE,str);
// FORMAT THE MESSAGE YOU WANT FOR ADMINS
// format( ... );
// SendClientMessageToAll( -1, str );
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] > 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s - Vip : %s",Account[playerid][Level],ARank,VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
// FORMAT THE MESSAGE YOU WANT FOR ADMINS AND VIPS
// format( ... );
// SendClientMessageToAll( -1, str );
}
else if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] == 0)
{
format(str,128,"{33CC33}>> You have been Automatically Logged in!");
SendClientMessage(playerid,COLOR_LBLUE,str);
}


Thank you for your effort and I appreciate it. But can you please fill what you wrote
// FORMAT THE MESSAGE YOU WANT FOR ADMINS AND VIPS
// format( ... );
// SendClientMessageToAll( -1, str );
to a real script?

Sorry im a complete noob. Hope you help me with this. Thanks alot!

Konstantinos
27/09/2013, 09:34 PM
That's probably the easiest thing.


new
name_[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, name_, MAX_PLAYER_NAME);
if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] > 0)
{
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Vip : %s",VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
format(str, 128, "%s (ID:%d) | %s - has been logged in the server.", name_, playerid, VRank );
SendClientMessageToAll(-1, str);
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] == 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s",Account[playerid][Level],ARank);
SendClientMessage(playerid,COLOR_LBLUE,str);
format(str, 128, "%s (ID:%d) | %s - has been logged in the server.", name_, playerid, ARank );
SendClientMessageToAll(-1, str);
}
else if(Account[playerid][Level] > 0 && Account[playerid][VipLevel] > 0)
{
switch(Account[playerid][Level])
{
case 1: ARank = "{6EF83C}Moderator";
case 2: ARank = "{6EF83C}Master Moderator";
case 3: ARank = "{6EF83C}Admin";
case 4: ARank = "{6EF83C}Master Admin";
case 5: ARank = "{6EF83C}Server Owner";
}
new VRank[128];
switch(Account[playerid][VipLevel])
{
case 1: VRank = "{6EF83C}Silver";
case 2: VRank = "{6EF83C}Gold";
case 3: VRank = "{6EF83C}Premium";
}
format(str,128,"{33CC33}>> You have been Automatically Logged in - Level: %d - %s - Vip : %s",Account[playerid][Level],ARank,VRank);
SendClientMessage(playerid,COLOR_LBLUE,str);
format(str, 128, "%s (ID:%d) | %s and %s - has been logged in the server.", name_, playerid, ARank, VRank );
SendClientMessageToAll(-1, str);
}
else if(Account[playerid][Level] == 0 && Account[playerid][VipLevel] == 0)
{
format(str,128,"{33CC33}>> You have been Automatically Logged in!");
SendClientMessage(playerid,COLOR_LBLUE,str);
}