13.10.2011, 14:00
Well guys, while /spec it changes player automaticly
Code:
Code:
Код:
if (strcmp(cmd, "/spec", true) == 0) // Moddded By Weso. { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "[CMD]: /spec [playerid/PartOfName]"); return 1; } giveplayerid = ReturnUser(tmp); new Float:Health, Float:Armour; new World = GetPlayerVirtualWorld(playerid); new PlInterior = GetPlayerInterior(playerid); new weaponid, ammo; GetPlayerHealth(playerid, Health); GetPlayerArmour(playerid, Armour); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(Spectate[playerid] == 255) { GetPlayerPos(playerid, TeleportDest[playerid][0],TeleportDest[playerid][1],TeleportDest[playerid][2]); if(PlayerInfo[playerid][pAdmin] >= 6) { if(PlayerInfo[playerid][pAdminDuty] == 1) { for (new i=0; i<13; i++) { GetPlayerWeaponData(playerid, i, weaponid, ammo); OtherWeapons[playerid][i] = weaponid; OtherAmmo[playerid][i] = ammo; } SpHealth[playerid] = Health; SpArmour[playerid] = Armour; } else { SaveGuns(playerid); PlayerInfo[playerid][pHealth] = Health; PlayerInfo[playerid][pArmour] = Armour; } } else { SaveGuns(playerid); PlayerInfo[playerid][pHealth] = Health; PlayerInfo[playerid][pArmour] = Armour; } } Interior[playerid] = PlInterior; VirWorld[playerid] = World; TogglePlayerSpectating(playerid, 1); if(IsPlayerInAnyVehicle(giveplayerid)) { PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid)); } else { PlayerSpectatePlayer(playerid, giveplayerid); } Spectate[playerid] = giveplayerid; SafeSetPlayerInterior(playerid, GetPlayerInterior(giveplayerid)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); format(string, sizeof(string), "[ADMIN]: %s Is Now Spectating %s (%d).", sendername, giveplayer, giveplayerid); SendAdminMessage(COLOR_LIGHTRED,string); SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now spectating this player. To Unspec him spec another id or type /endspec <playerid>"); TextDrawHideForPlayer(playerid, Textdraw44); TextDrawHideForPlayer(playerid, Textdraw45); TextDrawHideForPlayer(playerid, Textdraw55); TextDrawHideForPlayer(playerid, Textdraw51[playerid]); if(PlayerInfo[playerid][pWatch] == 1) { TextDrawHideForPlayer(playerid, Textdraw56); TextDrawHideForPlayer(playerid, Textdraw57); TextDrawHideForPlayer(playerid, Textdraw58); } new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s is speccing %s's",d,m,y,h,mi,s,sendername,giveplayer); AdminLog(string); } } else { SendClientMessage(playerid, COLOR_GRAD1, " No Such Player"); } } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not an admin"); } } return 1; }