Код:
#include <a_samp>
#define SendMessage(%0,%1,%2,%3) new Message[200]; format(Message,sizeof(Message),%2,%3); SendClientMessage(%0,%1,Message)
#define SendMessageToAll(%0,%1,%2) new Message[200]; format(Message,sizeof(Message),%1,%2); SendClientMessageToAll(%0,Message)
#define RCON_PASSWORD "AnyPassword"
#define HOSTNAME "[PL] ...:::[PSF]:::... Polski Serwer Freeroam"
#define WEBURL "Www.PSF.Xaa.Pl"
#define MAPNAME "...:::[PSF]:::..."
#define GAMEMODETEXT "[PL] ...:::[PSF]:::..."
#define SLOTS 30
#define FILE_PLAYERS "Players/"
#define AQUA "{00FFFF}"
#define DARK_AQUA "{00BBBB}"
#define RED "{FF0000}"
#define DARK_RED "{BB0000}"
#define GREEN "{00FF00}"
#define DARK_GREEN "{00BB00}"
new pName[SLOTS][MAX_PLAYER_NAME];
new pIp[SLOTS][20];
new pFile[SLOTS][30];
new pLoggedIn[SLOTS];
new pRespect[SLOTS];
new pMoney[SLOTS];
new pLevel[SLOTS];
new pRespectToNextLevel[SLOTS];
new pSuicides[SLOTS];
new pDeaths[SLOTS];
new pKills[SLOTS];
new pSendMessages[SLOTS];
new pSendCommands[SLOTS];
new pHeadAdministrator[SLOTS];
new pAdministrator[SLOTS];
new pJuniorAdministrator[SLOTS];
new pModerator[SLOTS];
new pVip[SLOTS];
main()
{
print("Gamemode successfully loaded.");
print("Rcon_Password "RCON_PASSWORD"");
print("Hostname "HOSTNAME"");
print("Weburl "WEBURL"");
print("Mapname "MAPNAME"");
print("Gamemodetext "GAMEMODETEXT"");
printf("Slots %d",SLOTS);
}
public OnGameModeInit()
{
ShowNameTags(1);
ShowPlayerMarkers(1);
AllowInteriorWeapons(1);
UsePlayerPedAnims();
DisableInteriorEnterExits();
DisableNameTagLOS();
SendRconCommand("Rcon_Password "RCON_PASSWORD"");
SendRconCommand("Hostname "HOSTNAME"");
SendRconCommand("Weburl "WEBURL"");
SendRconCommand("Mapname "MAPNAME"");
SendRconCommand("Gamemodetext "GAMEMODETEXT"");
return 1;
}
public OnGameModeExit()
{
print("Gamemode successfully unloaded.");
return 1;
}
public OnPlayerRequestClass(playerid,classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid,pName[playerid],MAX_PLAYER_NAME);
GetPlayerIp(playerid,pIp[playerid],20);
format(pFile[playerid],30,"%s%s.ini",FILE_PLAYERS,pName[playerid]);
pLoggedIn[playerid] = 0;
pRespect[playerid] = 0;
pMoney[playerid] = 0;
pLevel[playerid] = 0;
pSuicides[playerid] = 0;
pDeaths[playerid] = 0;
pKills[playerid] = 0;
pSendMessages[playerid] = 0;
pSendCommands[playerid] = 0;
pRespectToNextLevel[playerid] = 0;
pHeadAdministrator[playerid] = 0;
pAdministrator[playerid] = 0;
pJuniorAdministrator[playerid] = 0;
pModerator[playerid] = 0;
pVip[playerid] = 0;
for(new I = 0; I < GetMaxPlayers(); I++)
{
if(IsPlayerConnected(I))
{
if(IsPlayerAdministrator(I))
{
SendMessage(I,0,""AQUA">> Gracz "DARK_AQUA"%s (ID %d) (IP %s) "AQUA"dołączył do serwera.",pName[playerid],playerid,pIp[playerid]);
}
if(!IsPlayerAdministrator(I))
{
SendMessage(I,0,""AQUA">> Gracz "DARK_AQUA"%s (ID %d) "AQUA"dołączył do serwera.",pName[playerid],playerid);
}
}
}
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
if(reason == 0)
{
SendMessageToAll(0,""AQUA">> Gracz "DARK_AQUA"%s (ID %d) "AQUA"opuścił serwer (Crash).",pName[playerid],playerid);
}
if(reason == 1)
{
SendMessageToAll(0,""AQUA">> Gracz "DARK_AQUA"%s (ID %d) "AQUA"opuścił serwer (Wyszedł).",pName[playerid],playerid);
}
if(reason == 2)
{
SendMessageToAll(0,""AQUA">> Gracz "DARK_AQUA"%s (ID %d) "AQUA"opuścił serwer (Kick/Ban).",pName[playerid],playerid);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid,22,100000);
GivePlayerWeapon(playerid,25,100000);
GivePlayerWeapon(playerid,29,100000);
if(pLevel[playerid] >= 10)
{
GivePlayerWeapon(playerid,27,100000);
}
if(pLevel[playerid] >= 20)
{
GivePlayerWeapon(playerid,32,100000);
}
if(pLevel[playerid] >= 30)
{
GivePlayerWeapon(playerid,4,100000);
}
if(pLevel[playerid] >= 40)
{
GivePlayerWeapon(playerid,24,100000);
}
if(pLevel[playerid] >= 50)
{
GivePlayerWeapon(playerid,30,100000);
}
if(pLevel[playerid] >= 60)
{
GivePlayerWeapon(playerid,26,100000);
}
if(pLevel[playerid] >= 70)
{
GivePlayerWeapon(playerid,28,100000);
}
if(pLevel[playerid] >= 80)
{
GivePlayerWeapon(playerid,31,100000);
}
if(pLevel[playerid] >= 90)
{
GivePlayerWeapon(playerid,34,100000);
}
if(pLevel[playerid] >= 100)
{
SetPlayerArmour(playerid,100.0000);
}
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
SendDeathMessage(killerid,playerid,reason);
if(!IsPlayerConnected(killerid))
{
pRespect[playerid] -= 1;
pMoney[playerid] -= 1000;
pSuicides[playerid] += 1;
SendClientMessage(playerid,0,""RED">> Popełniłeś samobуjstwo, tracisz 1 respektu i 1000$.");
}
if(IsPlayerConnected(killerid))
{
pRespect[playerid] -= 1;
pMoney[playerid] -= 1000;
pDeaths[playerid] += 1;
pRespect[killerid] += 10;
pMoney[killerid] += 10000;
pKills[killerid] += 1;
SendMessage(playerid,0,""RED">> Zostałeś zabity przez gracza "DARK_RED"%s (ID %d)"RED", tracisz 1 respektu i 1000$.",pName[killerid],killerid);
SendMessage(playerid,0,""GREEN">> Zabiłeś gracza "DARK_GREEN"%s (ID %d)"GREEN", otrzymujesz 10 respektu i 10000$.",pName[playerid],playerid);
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid,killerid)
{
return 1;
}
public OnPlayerText(playerid,text[])
{
return 1;
}
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid,vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid,objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid,pickupid)
{
return 1;
}
public OnVehicleMod(playerid,vehicleid,componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid,vehicleid,paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid,vehicleid,color1,color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid,row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[],password[],success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid,forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid,forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid,forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid,forplayerid)
{
return 1;
}
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid,clickedplayerid,source)
{
return 1;
}
IsPlayerAdministrator(PlayerID)
{
if(pHeadAdministrator[PlayerID] == 1)
{
return 1;
}
if(pAdministrator[PlayerID] == 1)
{
return 1;
}
return 0;
}
All is so good, but...
When you use SendMessage new Message[200] is created after every use.
At line 196 , you have used SendMessage, which creates Message[200] string.
At line 197, SendMessage again creates Message[200] string.
Oh thank you.