21.12.2010, 09:19
(
Последний раз редактировалось Stepashka; 21.12.2010 в 16:51.
)
pawn Код:
if(strcmp(cmd, "/add", true) == 0)
{
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, AAD_COLOR_RED, "*Âû äîëæíû áûòü àäìèíèñòðàòîðîì äëÿ èñïîëüçîâàíèÿ äàííîé êîìàíäû.");
}
else
{
if(Current == -1){SendClientMessage(playerid, AAD_COLOR_RED, "Íåëüçÿ äîáàâëÿòü èãðîêà ïîêà íå çàïóùåíà áàçà/àðåíà");return 1;}
cmd = strtok(cmdtext, idx);
new id2;
new strin[256];
strin = strtok(cmdtext, idx);
if(!strlen(strin))
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid(0-500)]");
return 1;
}
id2 = strval(strin);
if(id2<0 || id2>500)
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid(0-500)] [teamid] [hp]");
return 1;
}
if(!IsPlayerConnected(id2))
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid(Not Connected)] [teamid] [hp]");
return 1;
}
new teamid;
teamid = strval(strtok(cmdtext, idx));
if(teamid<1 || teamid>2)
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid] [teamid(1-ATT, 2-DEF)] [hp]");
return 1;
}
new hp;
hp = strval(strtok(cmdtext, idx));
if(hp<1 || hp>100)
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid] [teamid] [hp(1-100)]");
return 1;
}
new strok[256], fbase[STR], farena[STR], as[MAX_SPAWNS][tmp_spawns], ds[MAX_SPAWNS][tmp_spawns];
if(GetPlayerState(id2) == 9)
{
StopSpectate(id2);
}
SetPlayerArmour(id2,0);
Player[id2][pPlaying] = true;
Player[id2][pVoted] = false;
if(teamid==1) Player[id2][pTeam] = T_ATT;
else if(teamid==2) Player[id2][pTeam] = T_DEF;
else if(teamid==3) Player[id2][pTeam] = T_REF;
death[id2]=0;
game[id2] =1;
PlayerPlaySound(id2,1057,0.0,0.0,0.0);
if(GAMETYPE==0)
{
fbase = Basefile(Current);
format(strok, STR, "a_%d", 0);
idx = 0;
if(dini_Isset(fbase,strok))
{
strok = dini_Get(fbase,strok);
as[0][sx] = floatstr(strtok(strok,idx,','));
as[0][sy] = floatstr(strtok(strok,idx,','));
as[0][sz] = floatstr(strtok(strok,idx,','));
as[0][sin] = true;
}
else as[0][sin] = false;
format(strok, STR, "d_%d", 0);
idx = 0;
if(dini_Isset(fbase,strok))
{
strok = dini_Get(fbase,strok);
ds[0][sx] = floatstr(strtok(strok,idx,','));
ds[0][sy] = floatstr(strtok(strok,idx,','));
ds[0][sz] = floatstr(strtok(strok,idx,','));
ds[0][sin] = true;
}
else ds[0][sin] = false;
if(Player[id2][pTeam] == T_ATT)
{
SetSpawnInfo(id2,99,ATTACKER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,as[0][sx],as[0][sy],as[0][sz]);
mySetPlayerColor(id2,COLOR_ATT);
SetPlayerTeam(id2,2);SetPlayerTeam(id2,1);
}
else if(Player[id2][pTeam] == T_DEF)
{
SetSpawnInfo(id2,99,DEFENDER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,ds[0][sx],ds[0][sy],ds[0][sz]);
mySetPlayerColor(id2,COLOR_DEF);
SetPlayerTeam(id2,1);SetPlayerTeam(id2,2);
}
else if(Player[id2][pTeam] == T_REF)
{
SetSpawnInfo(id2,99,REFEREE_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,BaseCP[0],BaseCP[1],BaseCP[2]);
mySetPlayerColor(id2,COLOR_REF);
SetPlayerTeam(id2,3);
}
}
else if(GAMETYPE==1)
{
farena = Arenafile(Current);
GangZoneShowForPlayer(id2, zione[0], 0x000000AA);
GangZoneShowForPlayer(id2, zione[1], 0x000000AA);
GangZoneShowForPlayer(id2, zione[2], 0x000000AA);
GangZoneShowForPlayer(id2, zione[3], 0x000000AA);
format(strok, STR, "a_%d", 0);
idx = 0;
if(dini_Isset(farena,strok))
{
strok = dini_Get(farena,strok);
as[0][sx] = floatstr(strtok(strok,idx,','));
as[0][sy] = floatstr(strtok(strok,idx,','));
as[0][sz] = floatstr(strtok(strok,idx,','));
as[0][sin] = true;
}
else as[id][sin] = false;
format(strok, STR, "d_%d", 0);
idx = 0;
if(dini_Isset(farena,strok))
{
strok = dini_Get(farena,strok);
ds[0][sx] = floatstr(strtok(strok,idx,','));
ds[0][sy] = floatstr(strtok(strok,idx,','));
ds[0][sz] = floatstr(strtok(strok,idx,','));
ds[0][sin] = true;
}
else ds[0][sin] = false;
if(Player[id2][pTeam] == T_ATT)
{
SetSpawnInfo(id2,99,ATTACKER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,as[0][sx],as[0][sy],as[0][sz]);
mySetPlayerColor(id2,COLOR_ATT);
SetPlayerTeam(id2,2);SetPlayerTeam(id2,1);
}
else if(Player[id2][pTeam] == T_DEF)
{
SetSpawnInfo(id2,99,DEFENDER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,ds[0][sx],ds[0][sy],ds[0][sz]);
mySetPlayerColor(id2,COLOR_DEF);
SetPlayerTeam(id2,1);SetPlayerTeam(id2,2);
}
else if(Player[id2][pTeam] == T_REF)
{
SetSpawnInfo(id2,99,REFEREE_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,ArenaCP[0],ArenaCP[1],ArenaCP[2]);
mySetPlayerColor(id2,COLOR_REF);
SetPlayerTeam(id2,3);
}
}
DestroyObject(gWeaponObject[id2]);
gWeaponObject[id2] = -1;
gPlayerDeathWeapon[id2] = -1;
gPlayerDeathWeaponAmmo[id2] = -1;
TogglePlayerControllable(id2,1);
SetCameraBehindPlayer(id2);
SetPlayerInterior(id2,interior);
SetPlayerHealth(id2,hp);
ResetPlayerWeapons(id2);
StrapUp(id2);
MarkerStealth();
TeamFix();
format(strok,256,"%s äîáàâëåí â ðàóíä ñ %dHP",Player[id2][ppName],hp);
if(teamid==1) SendClientMessageToAll(AAD_COLOR_RED,strok);
if(teamid==2) SendClientMessageToAll(AAD_COLOR_GREEN,strok);
}
return 1;
}