Stock send message to admins. -
Osamakurdi - 09.02.2018
Can u give me a stock that send messages to all admin from this code:
Код:
CMD:setadmin(playerid, params[])
{
if(PInfo[playerid][Admin] < 6 && !IsPlayerAdmin(playerid)) return 0;
new targetid, level;
if(sscanf(params, "ui", targetid, level)) return SCM(playerid, -1, "USAGE:setadmin playerid level);
PInfo[targetid][Admin] = level;
SCM(playerid, -1, "You have made player an admin);
SCM(playerid, -1, "An admin has made u admin);
return 1;
}
Re: Stock send message to admins. -
Abagail - 09.02.2018
This isn't a request section, it's a scripting
help section. Have you tried doing it on your own, what obstacles are you facing in doing so?
Re: Stock send message to admins. -
Mugala - 09.02.2018
Abagail is right, but anyway.
PHP код:
stock SendAdminMessage(color,text[])
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(PInfo[i][Admin] > 0)
{
SendClientMessage(i,color,text);
}
}
return 1;
}
Re: Stock send message to admins. -
PepsiCola23 - 09.02.2018
Quote:
Originally Posted by Osamakurdi
Can u give me a stock that send messages to all admin from this code:
Код:
CMD:setadmin(playerid, params[])
{
if(PInfo[playerid][Admin] < 6 && !IsPlayerAdmin(playerid)) return 0;
new targetid, level;
if(sscanf(params, "ui", targetid, level)) return SCM(playerid, -1, "USAGE:setadmin playerid level);
PInfo[targetid][Admin] = level;
SCM(playerid, -1, "You have made player an admin);
SCM(playerid, -1, "An admin has made u admin);
return 1;
}
|
there is no function in here that sends a message just to admins.
SCM stands for SendClientMessage
and secondly,the code is incorrect. it should be
PHP код:
SCM(playerid, -1, "You have made player an admin);
SCM(targetid, -1, "An admin has made u admin);
Re: Stock send message to admins. -
Cycle - 09.02.2018
User, I believe that this function named as: "SCM", refers to a natively existing function, the "SendClientMessage".
Note that in the function below, it is missing to close the double quotation marks.
PHP код:
SCM(targetid, -1, "An admin has made u admin);
I think that would be correct:
PHP код:
SCM(targetid, -1, "An admin has made an admin");
If you want a function to send a message to only the administrators of the server, use the base that the user gave above.
PHP код:
stock SendAdminMessage(color, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PInfo[i][Admin] > 0)
{
SendClientMessage(i, color, string);
}
}
}
}
Everything is very simple, any doubt, only to be noted.
Re: Stock send message to admins. -
Osamakurdi - 10.02.2018
Thx All Codes Works
Quote:
Originally Posted by Cycle
User, I believe that this function named as: "SCM", refers to a natively existing function, the "SendClientMessage".
Note that in the function below, it is missing to close the double quotation marks.
PHP код:
SCM(targetid, -1, "An admin has made u admin);
I think that would be correct:
PHP код:
SCM(targetid, -1, "An admin has made an admin");
If you want a function to send a message to only the administrators of the server, use the base that the user gave above.
PHP код:
stock SendAdminMessage(color, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PInfo[i][Admin] > 0)
{
SendClientMessage(playerid, color, string);
}
}
}
}
Everything is very simple, any doubt, only to be noted.
|
but
it should be
Код:
SendClientMessage(i, color, string);
Re: Stock send message to admins. -
PepsiCola23 - 10.02.2018
[QUOTE=Cycle;3990821]User, I believe that this function named as: "SCM", refers to a natively existing function, the "SendClientMessage".
Note that in the function below, it is missing to close the double quotation marks.
PHP код:
SCM(targetid, -1, "An admin has made u admin);
I think that would be correct:
PHP код:
SCM(targetid, -1, "An admin has made an admin");
[QUOTE]
yeah i missed a ",my bad.
Re: Stock send message to admins. -
Mugala - 10.02.2018
Quote:
Originally Posted by Osamakurdi
but
it should be
Код:
SendClientMessage(i, color, string);
|
yeah my bad, it should be i.