09.05.2015, 15:35
(
Последний раз редактировалось Blackazur; 09.05.2015 в 16:26.
)
~fixed~
GetAdminName(playerid)
{
new adminname[32];
switch(pInfo[playerid][pAdminLevel])
{
case 0: adminname = "Test";
case 1: adminname = "Test";
case 2: adminname = "Test";
case 3: adminname = "Test";
case 4: adminname = "Test";
case 5: adminname = "Test";
}
return adminname;
}
printf("playerid: %d - Adminlevel: %s",playerid,GetAdminName(playerid));
switch(pInfo[playerid][pAdminLevel])
GetAdminName(playerid) // Use plain function instead of stock if you aren't making an include
{
new adminname[128];
switch(pInfo[playerid][pAdminLevel])
{
case 0: strpack(adminname, "Test"); // Right method and more faster.
case 1: strpack(adminname, "Test");
case 2: strpack(adminname, "Test");
case 3: strpack(adminname, "Test");
case 4: strpack(adminname, "Test");
case 5: strpack(adminname, "Test");
default: return 0;
}
return adminname;
}
// Example
public OnPlayerConnect(playerid)
{
new string[128], name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s %s has connected to the server!", GetAdminName(playerid), name);
for(new i = 0; i <= GetPlayerPoolSize(); ++i) // This send message like "Founder J4Rr3x has connected to the server!" to all online admins
if(IsPlayerConnected(i) && pInfo[playerid][pAdminLevel] > 0)
SendClientMessage(i, -1, string);
return 1;
}
stock GetAdminName(playerid)
{
new adminname[64];
switch(pInfo[playerid][pAdminLevel])
{
case 1:adminname = "Test";
case 2:adminname = "Test";
case 3:adminname = "Test";
case 4:adminname = "Test";
case 5:adminname = "Test";
}
return adminname;
}
@J4Rr3x:
You should write it like this: PHP код:
|
GetAdminName(playerid) // Use plain function instead of stock if you aren't making an include
{
new adminname[128];
switch(pInfo[playerid][pAdminLevel])
{
case 0: strpack(adminname, "Test"); // Right method and more faster.
case 1: strpack(adminname, "Test");
case 2: strpack(adminname, "Test");
case 3: strpack(adminname, "Test");
case 4: strpack(adminname, "Test");
case 5: strpack(adminname, "Test");
default: return 0;
}
return adminname;
}
// Example
public OnPlayerConnect(playerid)
{
new string[128], name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s %s has connected to the server!", GetAdminName(playerid), name);
for(new i = 0; i <= GetPlayerPoolSize(); ++i) // This send message like "Founder J4Rr3x has connected to the server!" to all online admins
if(IsPlayerConnected(i) && pInfo[playerid][pAdminLevel] > 0)
SendClientMessage(i, -1, string);
return 1;
}