PDA

View Full Version : >>> HELP <<<


Buzzbomb
14/10/2011, 06:02 PM
I Don't Know What it Is Some Reason When ever ID 0 OR 1 Dies Both of them Re-spawn.... Its Confusing I looked over the code Twenty times changed it around still the same... I have No Clue....

And When ever Another Player Joins Im Respawned with the other player and we both free fall from BlueBerry



I Don't Know What part Of the Code I Should Show...



forward OnPlayerLogged(playerid);
public OnPlayerLogged(playerid)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_ACCOUNTS, name);

PlayerInfo[playerid][pAccount] = dini_Int(file,"Account");
PlayerInfo[playerid][pAdminLevel] = dini_Int(file,"AdminLevel");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
PlayerInfo[playerid][pScore] = dini_Int(file, "Level");
PlayerInfo[playerid][pFirstname] = dini_Int(file, "Firstname");
PlayerInfo[playerid][pLastname] = dini_Int(file, "Lastname");
PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
PlayerInfo[playerid][pGender] = dini_Int(file, "Gender");
PlayerInfo[playerid][pReg] = dini_Int(file, "Registration");
PlayerInfo[playerid][pHouse] = dini_Int(file, "House");
PlayerInfo[playerid][pId] = dini_Int(file, "SSN");
PlayerInfo[playerid][pFrank] = dini_Int(file, "FireRank");
PlayerInfo[playerid][pPrank] = dini_Int(file, "PoliceRank");
PlayerInfo[playerid][pFireTeam] = dini_Int(file, "FireTeam");
PlayerInfo[playerid][pPoliceTeam] = dini_Int(file, "PoliceTeam");
PlayerInfo[playerid][pMedicTeam] = dini_Int(file, "MedicTeam");
PlayerInfo[playerid][pHealth] = dini_Int(file, "Health");
PlayerInfo[playerid][pArmour] = dini_Int(file, "Armour");
PlayerInfo[playerid][pCharacter] = dini_Int(file, "Character");
PlayerInfo[playerid][pLocX] = dini_Int(file, "LocX");
PlayerInfo[playerid][pLocY] = dini_Int(file, "LocY");
PlayerInfo[playerid][pLocZ] = dini_Int(file, "LocZ");
PlayerInfo[playerid][pLocA] = dini_Int(file, "LocA");
PlayerInfo[playerid][pLocI] = dini_Int(file, "LocI");
PlayerInfo[playerid][pLocW] = dini_Int(file, "LocW");
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);

SetPlayerSkin(playerid, PlayerInfo[playerid][pCharacter]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SafeSetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);

format(string, 128, "You Have Successfully Logged In With Account. %s ", name);
SendClientMessage(playerid, ORANGE, string);
SpawnLastSaved(playerid);
PlayerOnline[playerid] = 1;
return 1;
}


public SaveUserAccounts(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerOnline[playerid] == 1)
{
new file[24];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_ACCOUNTS, name);
dini_IntSet(file, "Account",PlayerInfo[playerid][pAccount]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash]);
dini_IntSet(file, "Level",PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Firstname",PlayerInfo[playerid][pFirstname]);
dini_IntSet(file, "Lastname",PlayerInfo[playerid][pLastname]);
dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender]);
dini_IntSet(file, "Registration",PlayerInfo[playerid][pReg]);
dini_IntSet(file, "House",PlayerInfo[playerid][pHouse]);
dini_IntSet(file, "SSN",PlayerInfo[playerid][pId]);
dini_IntSet(file, "FireRank",PlayerInfo[playerid][pFrank]);
dini_IntSet(file, "PoliceRank",PlayerInfo[playerid][pPrank]);
dini_IntSet(file, "FireTeam",PlayerInfo[playerid][pFireTeam]);
dini_IntSet(file, "PoliceTeam",PlayerInfo[playerid][pPoliceTeam]);
dini_IntSet(file, "MedicTeam",PlayerInfo[playerid][pMedicTeam]);
dini_FloatSet(file, "Health",PlayerInfo[playerid][pHealth]);
dini_FloatSet(file, "Armour",PlayerInfo[playerid][pArmour]);
dini_IntSet(file, "Character",PlayerInfo[playerid][pCharacter]);
dini_IntSet(file, "LocX",PlayerInfo[playerid][pLocX]);
dini_IntSet(file, "LocY",PlayerInfo[playerid][pLocY]);
dini_IntSet(file, "LocZ",PlayerInfo[playerid][pLocZ]);
dini_IntSet(file, "LocA",PlayerInfo[playerid][pLocA]);
dini_IntSet(file, "LocI",PlayerInfo[playerid][pLocI]);
dini_IntSet(file, "LocW",PlayerInfo[playerid][pLocW]);
}
}
}


forward SpawnLastSaved(playerid);
public SpawnLastSaved(playerid)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_ACCOUNTS, name);
SetPlayerPos(playerid, dini_Float(file, "LocX"),dini_Float(file,"LocY"),dini_Float(file,"LocZ"));
SetPlayerFacingAngle(playerid,dini_Float(file,"LocA"));
SetPlayerInterior(playerid,dini_Int(file,"LocI"));
SpawnPlayer(playerid);
return 1;
}



public SavePlayerPos(playerid)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_ACCOUNTS, name);
new Float:X, Float:Y, Float:Z, Float:A, Float:I, Float:W;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
I = GetPlayerInterior(playerid);
W = GetPlayerVirtualWorld(playerid);
dini_FloatSet(file, "LocX", X);
dini_FloatSet(file, "LocY", Y);
dini_FloatSet(file, "LocZ", Z);
dini_FloatSet(file, "LocA", A);
dini_FloatSet(file, "LocI", I);
dini_FloatSet(file, "LocW", W);
dini_IntSet(file, "LocI", GetPlayerInterior(playerid));
dini_IntSet(file, "LocW", GetPlayerVirtualWorld(playerid));
return 1;
}



There Nothing In OnPlayerDeath

Buzzbomb
14/10/2011, 07:43 PM
OMG WHERE IS HELP AND SUPPORT..... nearly 50 new topics Dated to last year and STILL NO Support...................................

AeroBlast
14/10/2011, 07:50 PM
I think, but i don't know if I'm right, that there's something wrong with your load script.
PlayerInfo[playerid][pHealth] = dini_Int(file, "Health");
PlayerInfo[playerid][pArmour] = dini_Int(file, "Armour");
PlayerInfo[playerid][pLocX] = dini_Int(file, "LocX");
PlayerInfo[playerid][pLocY] = dini_Int(file, "LocY");
PlayerInfo[playerid][pLocZ] = dini_Int(file, "LocZ");
PlayerInfo[playerid][pLocA] = dini_Int(file, "LocA");
PlayerInfo[playerid][pLocI] = dini_Int(file, "LocI");
PlayerInfo[playerid][pLocW] = dini_Int(file, "LocW");
should be dini_Float because Health and Armour are floats, just like Positions http://wiki.sa-mp.com/wiki/Floats

Buzzbomb
14/10/2011, 07:55 PM
I did that a while back Didnt help for the health and armour so i had Create a new function.. to load health and armour

DRIFT_HUNTER
14/10/2011, 07:57 PM
OnPlayerConnect
OnPlayerRequestSpawn
OnPlayerSpawn
OnPlayerRequestClass

Check in there for SetPlayerPos

Buzzbomb
14/10/2011, 10:10 PM
OnPlayerConnect Nope...
OnPlayerRequestSpawn Nope..
OnPlayerSpawn Nope..
OnPlayerRequestClass nope ..



if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_ACCOUNTS, name);
if(!response)
{
SendClientMessage( playerid, WHITE, "Fine, have it your way!" );
Kick( playerid );
}
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "This account is registered in our data base.", "Enter your password below, or leave if you're the wrong person", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, RED, "..::Invalid password::.. Re-enter your password correctly or leave!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "This account is registered in our data base.", "Enter your password below, or leave if you're a wrong person", "Login", "Leave");
}
else
{
IsPlayerSpawned[playerid] = 0;
OnPlayerLogged(playerid); // This Has The SpawnLastSaved Function
}
}

AeroBlast
14/10/2011, 10:35 PM
Could you show us u your OnPlayerSpawn?

Buzzbomb
14/10/2011, 10:54 PM
Wait I do have it on Spawn its the timer...

That might be my problem let me try with out it



public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), ARS_ACCOUNTS, name);
SetPlayerColor(playerid, WHITE );
if(PlayerOnline[playerid] == 1)
{
SendClientMessage(playerid, RED, "This server requires a Login before spawn");
Kick(playerid);
}
if(IsPlayerSpawned[playerid] == 0)
{
SendClientMessage(playerid, ORANGE, "Returning you to you're last saved position");
SetTimer("TimeSpawn", 50, false); //Spawn Player Last Position
}
YourNameHere[playerid] = TextDrawCreate(86.000000, 332.000000, " ");
TextDrawBackgroundColor(YourNameHere[playerid], 255);
TextDrawAlignment(YourNameHere[playerid], 2);
TextDrawFont(YourNameHere[playerid], 0);
TextDrawLetterSize(YourNameHere[playerid], 0.469999, 1.299999);
TextDrawColor(YourNameHere[playerid], ORANGE);
TextDrawSetOutline(YourNameHere[playerid], 1);
TextDrawSetProportional(YourNameHere[playerid], 1);
SetTimerEx("NameTexterDraw", 2000, false, "i", playerid);
if(HouseSpawn[playerid] != -1)
{
new i = HouseSpawn[playerid];
SetPlayerPos(playerid, HouseInfo[i][TeleX], HouseInfo[i][TeleY], HouseInfo[i][TeleZ]);
SetPlayerInterior(playerid, HouseInfo[i][Interior]);
Invited[playerid] = -1;
InHouse[playerid] = i;
SetPlayerVirtualWorld(playerid, HouseInfo[i][Virtual]);
SendClientMessage(playerid, 0x00C4F6AA, "You have spawned at your house");
}
return 1;
}

Buzzbomb
14/10/2011, 11:03 PM
Okay With me Disabling That I spawn in blue berry On Connect... damn this sucks..