SA-MP Forums Archive
On Player Connect/Disconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: On Player Connect/Disconnect (/showthread.php?tid=237254)



On Player Connect/Disconnect - wheelman_WM - 09.03.2011

Код:
public OnPlayerConnect(playerid)
{
	new playrname[MAX_PLAYER_NAME];
    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"RAPPING");
    PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"SMOKING");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"ON_LOOKERS");
    PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"PED");
    PlayerInfo[playerid][SpawnDance] = true;
    
    SetTimerEx("Autorepair",500,true,"d",playerid);


    new Text:text = TextDrawCreate(5.0, 400.0,Text_Under_Minimap);
	TextDrawUseBox(text, 0);
	TextDrawFont(text, 1);
	TextDrawSetShadow(text,0);
	TextDrawSetOutline(text,1);
	TextDrawBackgroundColor(text,0x000000FF);
	TextDrawColor(text,0xFFFFFFFF);
	TextDrawShowForPlayer(playerid, text);

	GameTextForPlayer(playerid,"~w~ ~r~ Gta Arena ~g~ Party ~b~ Server ~B~ Mode",5000,5);
	SendPlayerFormattedText(playerid, "Welcome to Gta Arena Party Server ", 0);
    SendPlayerFormattedText(playerid, "Have Fun Its A Gta Arena Server",0);
 SendClientMessage(playerid, COLOR_GREEN, "Please type /help to get started.");
 SendClientMessage(playerid, COLOR_GREEN, "Join Export Vehicle and get into the place to win cash.");
 SendClientMessage(playerid, COLOR_GREEN, "If u want your stats to be saved than get registered use /register password.");
    SendClientMessage(playerid, COLOR_GREEN, "If u want to save your position use /savepos and than to go back use /r.");
	SendClientMessage(playerid, COLOR_GREEN, "Your stats are being stored in our database.");
	SendClientMessage(playerid, COLOR_GREEN, "Please visit our forum : www.Arena-Gta.tk.");
    SendClientMessage(playerid, COLOR_GREEN, "Use /Teleports.");
	gActivePlayers[playerid]++;
	gLastGaveCash[playerid] = GetTickCount();

	playerCheckpoint[playerid]=999;
	bank[playerid]=0;
	playerGang[playerid]=0;
	gangInvite[playerid]=0;

	GetPlayerName(playerid, playrname, sizeof(playrname));
	for(new i = 0; i < MAX_SAVE; i++) {

	    if(isStringSame(savedNames[i], playrname, MAX_PLAYER_NAME)) {
			GivePlayerMoney(playerid, savedInfo[i][0]);
			bank[playerid] = savedInfo[i][1];
			bounty[playerid] = savedInfo[i][2];

			savedInfo[i][0]=savedInfo[i][1]=savedInfo[i][2]=0;
			savedNames[i][0]=0;

			for(new j = 0; j < MAX_WEAPONS; j++) {
				playerWeapons[playerid][j]=savedWeapons[i][j];
				savedWeapons[i][j]=0;
			}

			SendClientMessage(playerid, COLOR_GREEN, "Your money has been restored.");
		}
	}

  PLAYERLIST_authed[playerid]=false;
  return false;
}
Код:
public OnPlayerDisconnect(playerid)
{
	new playername[MAX_PLAYER_NAME];
    KillTimer( PlayerInfo[playerid][SpawnTimer] );
	gActivePlayers[playerid]--;

	for(new i = 0; i < MAX_PROPERTIES; i++) {
		if(propertyOwner[i]==playerid) {
		    propertyOwner[i] = 999;
		    GivePlayerMoney(playerid, propertyValues[i]);
  		}
	}

	//Save temp info for timeouts/crashes
	GetPlayerName(playerid, playername, sizeof(playername));
	format(savedNames[savePos], MAX_PLAYER_NAME, "%s",playername);

	savedInfo[savePos][0] = GetPlayerMoney(playerid);
	savedInfo[savePos][1] = bank[playerid];
	savedInfo[savePos][2] = bounty[playerid];
	savedInfo[savePos][3] = 0;

	for(new i = 0; i < MAX_WEAPONS; i++)
		savedWeapons[savePos][i]=playerWeapons[playerid][i];
	//
	savePos++;
	if(savePos >= MAX_SAVE)
	    savePos = 0;

	PlayerLeaveGang(playerid);
	bounty[playerid] = 0;

	for(new i = 0; i < MAX_WEAPONS;i++) {
		playerWeapons[playerid][i]=0;
	}

  if (PLAYERLIST_authed[playerid]) {
     // Was loggedin, so save the data!
    dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  }
  PLAYERLIST_authed[playerid]=false;
  return false;
}
It doesnt shows when a player connects and disconnects.


Re: On Player Connect/Disconnect - Davz*|*Criss - 09.03.2011

Just listen paste the fs on www.pastebin.com

Please


Re: On Player Connect/Disconnect - Stigg - 09.03.2011

You hav'nt set it up for connect or dissconnect messages. At least i cant see it in your code, correct me if i'm wrong.


Re: On Player Connect/Disconnect - [WF]Demon - 09.03.2011

How do you know its not a GM? Quit asking for scripts please, It makes you sound like a script stealer, Which you may be.

Anyways.

There are no messages for connect and disconnect? How could it be showing in the first place

EDIT

Too late, Still leaves my questions of why this guy is asking for scripts on every topic he posts on.


Re: On Player Connect/Disconnect - Stigg - 09.03.2011

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
Just listen paste the fs on www.pastebin.com

Please
You work for pastebin or something, thats all you say "put it on pastebin" lmao..


Re: On Player Connect/Disconnect - Davz*|*Criss - 09.03.2011

Yeah dude its half code, How can we understanad unless he post full fs ??

Its hard to understand, cuz he may be defined other things.

Lmao.


Re: On Player Connect/Disconnect - wheelman_WM - 09.03.2011

its not half it full
lolz
i want u guys to add that thing player has joined the server and left the server


Re: On Player Connect/Disconnect - Roomeo - 09.03.2011

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s has joined the server. Welcome!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
Change the Color i guess you know how to


Re: On Player Connect/Disconnect - wheelman_WM - 09.03.2011

i know so this topic is going ro locky locky


Re: On Player Connect/Disconnect - Mean - 09.03.2011

Quote:
Originally Posted by wheelman_WM
Посмотреть сообщение
i know
If you know, why are you asking for help?