11.08.2010, 04:27
how can i script a command that when a player types /alive it shows the people on TEAM_HIDER 0 please help.
// top #define SLOTS yourslotsfortheserver // in your command new aname[20],str[32]; for(new i=0;i<SLOTS;i++) // loops through all slots on the server { if(IsPlayerConnected(i) && Teamvar[playerid] ==TEAM_HIDER) // if player is connected and player is in team_hider // replace Teamvar with your variable for teams, like gTeam { GetPlayerName(i,aname,20); // get a name of an alive player format(string,32,"[ALIVE] %s",aname); // set str's value to "[ALIVE] aname" SendClientMessage(playerid,COLOR,str); // send str to the player, who typed the command..:D have fun! } }
like this:
Код:
// top #define SLOTS yourslotsfortheserver // in your command new aname[20],str[32]; for(new i=0;i<SLOTS;i++) // loops through all slots on the server { if(IsPlayerConnected(i) && Teamvar[playerid] ==TEAM_HIDER) // if player is connected and player is in team_hider // replace Teamvar with your variable for teams, like gTeam { GetPlayerName(i,aname,20); // get a name of an alive player format(string,32,"[ALIVE] %s",aname); // set str's value to "[ALIVE] aname" SendClientMessage(playerid,COLOR,str); // send str to the player, who typed the command..:D have fun! } } |
if(!strcmp(cmdtext, "/alive", true)) {
new zzst[24];
for(new i = 0; i < GetMaxPlayers(); i ++ ) {
if(!IsPlayerConnected(i)) continue;
if(GetPlayerTeam(i) == TEAM_HIDER) {
GetPlayerName(i, zzst, 24);
SendClientMessage(playerid, 0xFFFFFFA, zzst);
}
}
}
Uhm, lets try something simple.
pawn Код:
|
if(!strcmp(cmdtext, "/alive", true)) {
new zzst[24];
for(new i = 0; i < GetMaxPlayers(); i ++ ) {
if(!IsPlayerConnected(i)) continue;
if(GetPlayerTeam(i) == TEAM_HIDER) {
GetPlayerName(i, zzst, 24);
SendClientMessage(playerid, 0xFFFFFFA, zzst);
}
}
return 1;
}
if(!strcmp(cmdtext, "/alive", true))
{
new zzst[24];
for(new i = 0; i < GetMaxPlayers(); i ++ ) {
if(!IsPlayerConnected(i)) continue;
if(GetPlayerTeam(i) == TEAM_HIDER) {
GetPlayerName(i, zzst, 24);
SendClientMessage(playerid, 0xFFFFFFA, zzst);
}
}
return 1;
}