18.01.2015, 04:38
after input password
i can't spawn
why?
i can't spawn
why?
public OnPlayerLogin(playerid,password[])
{
PreloadAnims(playerid);
if(toglogin == 0)
{
new string[128];
format(string, sizeof(string), "{FF0000}%s {33AA33}Telah bergabung kedalam server.", GetPlayerNameEx(playerid));
SendClientMessageToAll(COLOR_WHITE,string);
}
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
return 1;
}
else
{
new string[128];
new tmp2[256];
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "users/%s.ini", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
}
if( strfind( PlayerInfo[playerid][pKey], "\r", true) != -1)
{
format(string, sizeof(string), "Warning: \\r found in player %s's password. Removing now. Password Before: %s", GetPlayerNameEx(playerid), PlayerInfo[playerid][pKey]);
Log("logs/password.log", string);
new pos = strfind( PlayerInfo[playerid][pKey], "\r", true);
strdel(PlayerInfo[playerid][pKey], pos, pos+2);
format(string, sizeof(string), "%s's Password After: %s (Note these passwords are encrypted)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pKey]);
Log("logs/password.log", string);
}
// loadd player data!
// load player data
PlayerInfo[playerid][pAdjustable] = 0;
ResetPlayerMoney(playerid);
CurrentMoney[playerid] = GetPVarInt(playerid, "Cash");
TotalLogin++;
if( PlayerInfo[playerid][pPermaBanned] == 3 || PlayerInfo[playerid][pBanned] >= 1 )
{
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32);
format(string2, sizeof(string2), "WARNING: %s (IP:%s) tried to login whilst banned and has been auto-banned.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pIP] );
ABroadCast(COLOR_YELLOW, string2, 2);
new IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));
new string1[500];
new adminban[MAX_PLAYER_NAME];
strmid(adminban, PlayerInfo[MAX_PLAYER_NAME][pAdminban], 0, strlen(PlayerInfo[MAX_PLAYER_NAME][pAdminban]), 255);
format(string1, sizeof(string1), "Akun atau IP anda telah di banned!\n\nAccount: %s\nIP: %s\nDi banned oleh: %s \nAlasan: %s \nPada Waktu: %s | Tanggal: %s\n\nSihlakan Post forum bagian unban request",GetPlayerNameEx(playerid),PlayerInfo[playerid][pIP],PlayerInfo[playerid][pAdminban],PlayerInfo[playerid][pBanReason],PlayerInfo[playerid][pBanExpired],PlayerInfo[playerid][pBanExpired2]);
ShowPlayerDialog(playerid,BAN_DIALOG,DIALOG_STYLE_MSGBOX,"BANNED",string1,"OK","");
SendClientMessageEx( playerid, COLOR_LIGHTRED, "SERVER: You're banned from this server." );
}
if(PlayerInfo[playerid][pAdmin] > 0)
{
new tempip[32];
GetPlayerIp(playerid, tempip, 32);
if(strcmp(tempip, PlayerInfo[playerid][pIP], true))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has logged on with the IP %s - Original IP: %s", name, tempip, PlayerInfo[playerid][pIP]);
Log("logs/security.log", string);
}
}
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
if(PlayerInfo[playerid][pReg] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pSHealth] = 0.0;
PlayerInfo[playerid][pSArmor] = 0.0;
PlayerInfo[playerid][pHealth] = 100.0;
PlayerInfo[playerid][pLocal] = 255;
PlayerInfo[playerid][pTeam] = 3;
PlayerInfo[playerid][pPnumber] = 0;
PlayerInfo[playerid][pPulsa2] = 0;
PlayerInfo[playerid][pFMax] = 0;
PlayerInfo[playerid][pFTime] = 0;
PlayerInfo[playerid][pPDTime] = 3600;
PlayerInfo[playerid][pATM] = 0;
PlayerInfo[playerid][pPBiskey2] = 0;
PlayerInfo[playerid][pJTime] = 0;
PlayerInfo[playerid][pTTime] = 0;
PlayerInfo[playerid][pKTPTime] = 0;
PlayerInfo[playerid][pBeratIkan] = 0;
PlayerInfo[playerid][pPhousekey] = INVALID_HOUSE_ID;
PlayerInfo[playerid][pPhousekey2] = INVALID_HOUSE_ID;
PlayerInfo[playerid][pAccount] = 0;
PlayerInfo[playerid][pReg] = 1;
PlayerInfo[playerid][pHunger] = 100;
PlayerInfo[playerid][pKondisi] = 0;
PlayerInfo[playerid][pBladder] = 100;
PlayerInfo[playerid][pEnergi] = 100;
SetProgressBarValue(kondisi[playerid], PlayerInfo[playerid][pKondisi]);
SetProgressBarValue(hungbar[playerid], PlayerInfo[playerid][pHunger]);
SetProgressBarValue(stabar[playerid], PlayerInfo[playerid][pEnergi]);
SetProgressBarValue(bladbar[playerid], PlayerInfo[playerid][pBladder]);
PlayerInfo[playerid][pComponent] = 0;
PlayerInfo[playerid][pBoomBox] = 0;
GivePlayerCash(playerid, 4500);
}
if(PlayerInfo[playerid][pHospital] == 1)
{
PlayerInfo[playerid][pHospital] = 0;
SetPVarInt(playerid, "MedicBill", 1);
}
if( PlayerInfo[playerid][pBanAppealer] >= 1 && PlayerInfo[playerid][pAdmin] < 1) PlayerInfo[playerid][pBanAppealer] = 0;
if( PlayerInfo[playerid][pBanAppealer] > 1) PlayerInfo[playerid][pBanAppealer] = 0;
if( PlayerInfo[playerid][pHelper] == 1 && PlayerInfo[playerid][pAdmin] == 1) PlayerInfo[playerid][pHelper] = 0;
if(PlayerInfo[playerid][pDisabled] != 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "SERVER: This account is disabled!");
Kick(playerid);
return 1;
}
if(PlayerInfo[playerid][pJob2] >= 1 && PlayerInfo[playerid][pDonateRank] < 1)
{
PlayerInfo[playerid][pJob2] = 0;
SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: You have lost your secondary job due to the fact that you are longer a VIP.");
}
if(PlayerInfo[playerid][pATM] <= 0)
{
GivePlayerCash(playerid, PlayerInfo[playerid][pAccount]);
PlayerInfo[playerid][pAccount] = 0;
}
if(PlayerInfo[playerid][pPDTime] <= 0) { SendClientMessageEx(playerid,COLOR_YELLOW,"Pergilah ke bank lalu /signcheck untuk mendapat kan paycheck anda."); }
if(PlayerInfo[playerid][pDonateRank] >= 4 && PlayerInfo[playerid][pArmsSkill] < 400)
{
PlayerInfo[playerid][pArmsSkill] = 401;
SendClientMessageEx(playerid, COLOR_YELLOW, "Platinum VIP Feature: You have been given Level 5 Arms Dealer.");
}
if (PlayerInfo[playerid][pAdmin] >= 2)
{
PlayerInfo[playerid][pToggedVIPChat] = 1;
}
if (PlayerInfo[playerid][pLevel] < 6 || PlayerInfo[playerid][pAdmin] > 0 || PlayerInfo[playerid][pHelper] > 0)
{
gNewbie[playerid] = 0;
}
if (PlayerInfo[playerid][pHelper] == 1)
{
gHelp[playerid] = 0;
}
if (PlayerInfo[playerid][pAdmin] > 0)
{
if(PlayerInfo[playerid][pAdmin] == 1)
{
SendClientMessageEx(playerid, COLOR_WHITE,"SERVER: You are logged in as a Moderator.");
}
else
{
format(string2, sizeof(string2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessageEx(playerid, COLOR_WHITE,string2);
}
if(PlayerInfo[playerid][pAdmin] == 1)
{
format( string2, sizeof( string2 ), "SERVER: %s has logged in as a Moderator.", GetPlayerNameEx( playerid ));
}
else
{
format( string2, sizeof( string2 ), "SERVER: %s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] );
}
foreach(Player, i)
{
if( PlayerInfo[i][pAdmin] >= 1337 )
{
if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2);
}
}
}
new playerip[32];
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(PlayerInfo[playerid][pIP], 32, "%s", playerip);
printf("%s has logged in.",playername2);
format(tmp2, sizeof(tmp2), "SERVER: Selamat datang, %s.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_WHITE, tmp2);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
SkinDelay(playerid);
SetCamBack(playerid);
RandMask[playerid] = random(89999)+10000;
if(PlayerInfo[playerid][pInt] > 0 || PlayerInfo[playerid][pVW] > 0)
{
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "Objects loading...", 4000, 5);
SetPVarInt(playerid, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", playerid);
}
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = PlayerInfo[playerid][pTeam];
}
gPlayerLogged{playerid} = 1;
SetPVarInt(playerid, "MedicBill", 0);
SpawnPlayer(playerid);
format(tmp2, sizeof(tmp2), "~w~Selamat Datang~n~~y~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SendClientMessageEx(playerid, COLOR_YELLOW, GlobalMOTD);
if(PlayerInfo[playerid][pAdmin] >= 2)
{
SendClientMessageEx(playerid, COLOR_YELLOW, AdminMOTD);
}
if(PlayerInfo[playerid][pAdmin] > 0)
{
SendClientMessageEx(playerid, TEAM_AZTECAS_COLOR, CAMOTD);
}
if(PlayerInfo[playerid][pHelper] >= 1) SendClientMessageEx(playerid, TEAM_AZTECAS_COLOR, CAMOTD);
SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightStyle]);
LoadPlayerVehicles(playerid);
LoadPlayerRent(playerid);
WeedLogin(playerid);
CancelFlyMode(playerid);
SetPlayerToTeamColor(playerid);
if(PlayerInfo[playerid][pFMember] < 255)
{
format(tmp2, sizeof(tmp2), "Family MOTD: %s.", FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyMOTD]);
SendClientMessageEx(playerid, COLOR_YELLOW, tmp2);
}
//Convert old flags to new system
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "flags/%s.ini",playername);
if(fexist(string))
{
new fReason[128];
new File: file = fopen(string, io_read);
if (file)
{
fread(file, fReason);
format(PlayerInfo[playerid][pFlag],128,"%s",fReason);
fclose(file);
fremove(string);
}
}
if(strlen(PlayerInfo[playerid][pFlag]) > 0)
{
format(string2, sizeof(string2), "SERVER: %s has an outstanding flag.",playername2);
ABroadCast(COLOR_WHITE, string2, 2);
}
if(PlayerInfo[playerid][pOrder] > 0)
{
format(string2, sizeof(string2), "SERVER: %s has an outstanding shop order.",playername2);
ShopTechBroadCast(COLOR_WHITE, string2);
}
new hcheck, hcheck2, name[MAX_PLAYER_NAME];
hcheck = INVALID_HOUSE_ID;
hcheck2 = INVALID_HOUSE_ID;
GetPlayerName(playerid, name, sizeof(name));
for(new i = 0; i < MAX_HOUSES; i++)
{
if(!strcmp(name, HouseInfo[i][hOwner], false))
{
if(hcheck != INVALID_HOUSE_ID)
{
hcheck2 = i;
}
else
{
hcheck = i;
}
}
}
if(hcheck != INVALID_HOUSE_ID)
{
PlayerInfo[playerid][pPhousekey] = hcheck;
}
if(hcheck2 != INVALID_HOUSE_ID)
{
PlayerInfo[playerid][pPhousekey2] = hcheck2;
}
if(hcheck == INVALID_HOUSE_ID)
{
PlayerInfo[playerid][pPhousekey] = INVALID_HOUSE_ID;
return 1;
}
if(hcheck2 == INVALID_HOUSE_ID)
{
PlayerInfo[playerid][pPhousekey2] = INVALID_HOUSE_ID;
return 1;
}
}
return 1;
}
}
SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 ); SpawnPlayer(playerid);
Don't you get any ackslimits warning after logging or any error on your server log after logging?
|