Dini stuff doesn't get loaded under on player spawn
#1

I need help because my dini stuff under on player spawn doesn't get loaded.
You can also come to my pc with team viewer to trying to solve.

public OnPlayerSpawn(playerid)
{
if(spawned[playerid] == 0)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
SetPlayerSpecialAction(playerid,0);
PlayerPlaySound(playerid,1063,0.0,0.0,0.0);
SetTimerEx("Zonas",1000,true,"i",playerid);
spawned[playerid]=1;

new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PName, MAX_PLAYER_NAME);
format(AccountFile, sizeof(AccountFile), PLAYERFILE, PName);
if(fexist(AccountFile)) {

if(dini_Int(AccountFile, "randomspawn") == 1)
{
SetCameraBehindPlayer(playerid);
LoadData(playerid);
new rand = random(sizeof(RandomSpawn));
GivePlayerMoney(playerid,950);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);

SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
}

if(dini_Int(AccountFile, "randomspawn") == 0)
{
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid,COLOR_GREY,"* You have returned to {345BBF}your last positions.");
SetPlayerPos(playerid, dini_Float(AccountFile, "Pos_X"), dini_Float(AccountFile, "Pos_Y"), dini_Float(AccountFile, "Pos_Z"));
SetPlayerInterior(playerid, dini_Int(AccountFile, "Interior"));
SetPlayerVirtualWorld(playerid,0);
LoadData(playerid);
return 1;
}

if(dini_Int(AccountFile, "Parrot") == 1)
{
SetPlayerAttachedObject(playerid,INDEX,19078,1,0.3 20722,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000 000,1.000000); // Parrot
return 1;
}
SetPlayerArmour(playerid,dini_Int(AccountFile, "Armour"));
}
muisa[playerid]=0;

if(spawned[playerid] == 1)
{
TextDrawHideForPlayer(playerid,Textdraw41[playerid]);
TextDrawHideForPlayer(playerid,Textdraw57);
TextDrawHideForPlayer(playerid,wbt[playerid]);
TextDrawHideForPlayer(playerid, Textdraw153[playerid]);

return 1;
}


if(specoff[playerid] == 1)
{
LoadData(playerid);
SetPlayerPos(playerid,X5[playerid],Y5[playerid],Z5[playerid]);
SetPlayerInterior(playerid,interiorid5[playerid]);
return 1;
}

if(dm1[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid,0);
new dmspawnz = random(sizeof(dm1spawns));
dm1[playerid]=1;
SetPlayerPos(playerid, dm1spawns[dmspawnz][0], dm1spawns[dmspawnz][1],dm1spawns[dmspawnz][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,27,4500);
GivePlayerWeapon(playerid,31,5000);
SetCameraBehindPlayer(playerid);
return 1;
}
if(dm2[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid,0);
new dmspawnz = random(sizeof(dm2spawns));
dm2[playerid]=1;
SetPlayerPos(playerid, dm2spawns[dmspawnz][0], dm2spawns[dmspawnz][1],dm2spawns[dmspawnz][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,24,5000);
GivePlayerWeapon(playerid,34,5000);
SetCameraBehindPlayer(playerid);
return 1;
}
if(dm3[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid,0);
new dmspawnz = random(sizeof(dm3spawns));
dm3[playerid]=1;
SetPlayerPos(playerid, dm3spawns[dmspawnz][0], dm3spawns[dmspawnz][1],dm3spawns[dmspawnz][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,31,5000);
GivePlayerWeapon(playerid,32,5000);
GivePlayerWeapon(playerid,26,5000);
SetCameraBehindPlayer(playerid);
return 1;
}



if(newplayer[playerid] == 1)
{
new hand=random(2);
if (hand==0) { GivePlayerWeapon(playerid, 0, 1); }
else if (hand==1) { GivePlayerWeapon(playerid, 1, 1); }

new hand2=random(;
if (hand2==0) { GivePlayerWeapon(playerid, 2, 1); }
else if (hand2==1) { GivePlayerWeapon(playerid, 3, 1); }
else if (hand2==2) { GivePlayerWeapon(playerid, 4, 1); }
else if (hand2==3) { GivePlayerWeapon(playerid, 5, 1); }
else if (hand2==4) { GivePlayerWeapon(playerid, 6, 1); }
else if (hand2==5) { GivePlayerWeapon(playerid, 7, 1); }
else if (hand2==6) { GivePlayerWeapon(playerid, 8, 1); }
else if (hand2==7) { GivePlayerWeapon(playerid, 9, 1); }

new other=random(6);
if (other==0) { GivePlayerWeapon(playerid, 10, 1); }
else if (other==1) { GivePlayerWeapon(playerid, 11, 1); }
else if (other==2) { GivePlayerWeapon(playerid, 12, 1); }
else if (other==3) { GivePlayerWeapon(playerid, 13, 1); }
else if (other==4) { GivePlayerWeapon(playerid, 14, 1); }
else if (other==5) { GivePlayerWeapon(playerid, 15, 1); }

new pistol=random(3);
if (pistol==0) { GivePlayerWeapon(playerid, 22, 100); }
else if (pistol==1) { GivePlayerWeapon(playerid, 23, 100); }
else if (pistol==2) { GivePlayerWeapon(playerid, 24, 100); }

new shotgun=random(3);
if (shotgun==0) { GivePlayerWeapon(playerid, 25, 50); }
else if (shotgun==1) { GivePlayerWeapon(playerid, 26, 50); }
else if (shotgun==2) { GivePlayerWeapon(playerid, 27, 50); }

new smg=random(3);
if (smg==0) { GivePlayerWeapon(playerid, 28, 500); }
else if (smg==1) { GivePlayerWeapon(playerid, 29, 500); }
else if (smg==2) { GivePlayerWeapon(playerid, 32, 500); }

new assault=random(2);
if (assault==0) { GivePlayerWeapon(playerid, 30, 700); }
else if (assault==1) { GivePlayerWeapon(playerid, 31, 500); }

new rifle=random(2);
if (rifle==0) { GivePlayerWeapon(playerid, 33, 50); }
else if (rifle==1) { GivePlayerWeapon(playerid, 34, 50); }

new other2=random(3);
if (other2==0) { GivePlayerWeapon(playerid, 41, 50); }
else if (other2==1) { GivePlayerWeapon(playerid, 42, 50); }
else if (other2==2) { GivePlayerWeapon(playerid, 43, 50); }
GivePlayerMoney(playerid,950);
SetPlayerInterior(playerid,0);
new rand = random(sizeof(RandomSpawn));

// SetPlayerPos to the random spawn data
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);

// SetPlayerFacingAngle to the random facing angle data
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);

SendClientMessage(playerid,COLOR_GREEN,"* LOLLIPOPPIA.");
return 1;
}

return 1;
}
Reply
#2

1. Wrong section, should be in scripting discussion since its clearly a scripting mistake
2. Use [pawn][/pawn] tags

Did you check if the data you want to load exist in the player file ?
Reply
#3

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
1. Wrong section, should be in scripting discussion since its clearly a scripting mistake
2. Use [pawn][/pawn] tags

Did you check if the data you want to load exist in the player file ?
Yes them are here.
Reply
#4

You know whats pretty strange, the buch of returns in your code

If you just came from OnPlayerRequestClass the first return would stop the whole OnPlayerSpawn code...

Just remove all returns and leave the last one

And put the [pawn][/pawn] around your code, there is an edit button!
Reply
#5

Why still use dini? Its sort of outdated. Maybe start learning mysql. well just telling you
pawn Код:
public OnPlayerSpawn(playerid)
{
if(spawned[playerid] == 0)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
SetPlayerSpecialAction(playerid,0);
PlayerPlaySound(playerid,1063,0.0,0.0,0.0);
SetTimerEx("Zonas",1000,true,"i",playerid);
spawned[playerid]=1;

new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PName, MAX_PLAYER_NAME);
format(AccountFile, sizeof(AccountFile), PLAYERFILE, PName);
if(fexist(AccountFile)) {

if(dini_Int(AccountFile, "randomspawn") == 1)
{
SetCameraBehindPlayer(playerid);
LoadData(playerid);
new rand = random(sizeof(RandomSpawn));
GivePlayerMoney(playerid,950);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);

SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
}

if(dini_Int(AccountFile, "randomspawn") == 0)
{
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid,COLOR_GREY,"* You have returned to {345BBF}your last positions.");
SetPlayerPos(playerid, dini_Float(AccountFile, "Pos_X"), dini_Float(AccountFile, "Pos_Y"), dini_Float(AccountFile, "Pos_Z"));
SetPlayerInterior(playerid, dini_Int(AccountFile, "Interior"));
SetPlayerVirtualWorld(playerid,0);
LoadData(playerid);
return 1;
}

if(dini_Int(AccountFile, "Parrot") == 1)
{
SetPlayerAttachedObject(playerid,INDEX,19078,1,0.3 20722,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000 000,1.000000); // Parrot
return 1;
}
SetPlayerArmour(playerid,dini_Int(AccountFile, "Armour"));
}
muisa[playerid]=0;

if(spawned[playerid] == 1)
{
TextDrawHideForPlayer(playerid,Textdraw41[playerid]);
TextDrawHideForPlayer(playerid,Textdraw57);
TextDrawHideForPlayer(playerid,wbt[playerid]);
TextDrawHideForPlayer(playerid, Textdraw153[playerid]);

return 1;
}


if(specoff[playerid] == 1)
{
LoadData(playerid);
SetPlayerPos(playerid,X5[playerid],Y5[playerid],Z5[playerid]);
SetPlayerInterior(playerid,interiorid5[playerid]);
return 1;
}

if(dm1[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid,0);
new dmspawnz = random(sizeof(dm1spawns));
dm1[playerid]=1;
SetPlayerPos(playerid, dm1spawns[dmspawnz][0], dm1spawns[dmspawnz][1],dm1spawns[dmspawnz][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,27,4500);
GivePlayerWeapon(playerid,31,5000);
SetCameraBehindPlayer(playerid);
return 1;
}
if(dm2[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid,0);
new dmspawnz = random(sizeof(dm2spawns));
dm2[playerid]=1;
SetPlayerPos(playerid, dm2spawns[dmspawnz][0], dm2spawns[dmspawnz][1],dm2spawns[dmspawnz][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,24,5000);
GivePlayerWeapon(playerid,34,5000);
SetCameraBehindPlayer(playerid);
return 1;
}
if(dm3[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 1);
SetPlayerInterior(playerid,0);
new dmspawnz = random(sizeof(dm3spawns));
dm3[playerid]=1;
SetPlayerPos(playerid, dm3spawns[dmspawnz][0], dm3spawns[dmspawnz][1],dm3spawns[dmspawnz][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,31,5000);
GivePlayerWeapon(playerid,32,5000);
GivePlayerWeapon(playerid,26,5000);
SetCameraBehindPlayer(playerid);
return 1;
}



if(newplayer[playerid] == 1)
{
new hand=random(2);
if (hand==0) { GivePlayerWeapon(playerid, 0, 1); }
else if (hand==1) { GivePlayerWeapon(playerid, 1, 1); }

new hand2=random(;
if (hand2==0) { GivePlayerWeapon(playerid, 2, 1); }
else if (hand2==1) { GivePlayerWeapon(playerid, 3, 1); }
else if (hand2==2) { GivePlayerWeapon(playerid, 4, 1); }
else if (hand2==3) { GivePlayerWeapon(playerid, 5, 1); }
else if (hand2==4) { GivePlayerWeapon(playerid, 6, 1); }
else if (hand2==5) { GivePlayerWeapon(playerid, 7, 1); }
else if (hand2==6) { GivePlayerWeapon(playerid, 8, 1); }
else if (hand2==7) { GivePlayerWeapon(playerid, 9, 1); }

new other=random(6);
if (other==0) { GivePlayerWeapon(playerid, 10, 1); }
else if (other==1) { GivePlayerWeapon(playerid, 11, 1); }
else if (other==2) { GivePlayerWeapon(playerid, 12, 1); }
else if (other==3) { GivePlayerWeapon(playerid, 13, 1); }
else if (other==4) { GivePlayerWeapon(playerid, 14, 1); }
else if (other==5) { GivePlayerWeapon(playerid, 15, 1); }

new pistol=random(3);
if (pistol==0) { GivePlayerWeapon(playerid, 22, 100); }
else if (pistol==1) { GivePlayerWeapon(playerid, 23, 100); }
else if (pistol==2) { GivePlayerWeapon(playerid, 24, 100); }

new shotgun=random(3);
if (shotgun==0) { GivePlayerWeapon(playerid, 25, 50); }
else if (shotgun==1) { GivePlayerWeapon(playerid, 26, 50); }
else if (shotgun==2) { GivePlayerWeapon(playerid, 27, 50); }

new smg=random(3);
if (smg==0) { GivePlayerWeapon(playerid, 28, 500); }
else if (smg==1) { GivePlayerWeapon(playerid, 29, 500); }
else if (smg==2) { GivePlayerWeapon(playerid, 32, 500); }

new assault=random(2);
if (assault==0) { GivePlayerWeapon(playerid, 30, 700); }
else if (assault==1) { GivePlayerWeapon(playerid, 31, 500); }

new rifle=random(2);
if (rifle==0) { GivePlayerWeapon(playerid, 33, 50); }
else if (rifle==1) { GivePlayerWeapon(playerid, 34, 50); }

new other2=random(3);
if (other2==0) { GivePlayerWeapon(playerid, 41, 50); }
else if (other2==1) { GivePlayerWeapon(playerid, 42, 50); }
else if (other2==2) { GivePlayerWeapon(playerid, 43, 50); }
GivePlayerMoney(playerid,950);
SetPlayerInterior(playerid,0);
new rand = random(sizeof(RandomSpawn));

// SetPlayerPos to the random spawn data
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);

// SetPlayerFacingAngle to the random facing angle data
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);

SendClientMessage(playerid,COLOR_GREEN,"* LOLLIPOPPIA.");
return 1;
}

return 1;
}

Btw what did you mean by its not getting loaded?
Reply
#6

I cannot load dini things on spawn and iґm not going to use MySQL yet untill i have done my server with dini.
Reply
#7

I don't understand you. Dini things? as in which part? Randomspawns?

can you paste post a copy of your player's information?
Reply
#8

I mean all those dini stuffs under on player spawn like randomspawns etc.
Reply
#9

ok post a .ini file of your player. and i will see
Reply
#10

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
You know whats pretty strange, the buch of returns in your code

If you just came from OnPlayerRequestClass the first return would stop the whole OnPlayerSpawn code...

Just remove all returns and leave the last one

And put the [pawn][/pawn] around your code, there is an edit button!
Thank you Nero you solved it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)