spawning
#1

im trying to make team spawns using dini.

i use this code :
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    new file[256], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);

     if (dini_Int(file, "team") == 1) {
    SetPlayerPos(playerid,-217.4578,978.8492,19.5014);
    GivePlayerWeapon(playerid, 24, 250);
    return 1;
    }
        else if (dini_Int(file, "team") == 2) {
    SetPlayerPos(playerid,-320.0699,1048.6085,20.3403);
    return 1;
    }
      else if (dini_Int(file, "team") == 3) {
    SetPlayerPos(playerid, -73.5261,16.3937,5.9605);
    return 1;
    }
      else if (dini_Int(file, "team") == 4) {
    SetPlayerPos(playerid, -136.2579,1116.7528,20.1966);
    return 1;
    }
      else if (dini_Int(file, "team") == 5) {
    SetPlayerPos(playerid, -370.5210,1167.1810,20.2719);
    return 1;
    }
        else if (dini_Int(file, "team") == 6) {
    SetPlayerPos(playerid, 106.6390,-182.9938,1.4942);
    return 1;
    }
        else if (dini_Int(file, "team") == 7) {
    SetPlayerPos(playerid, 870.1599,-25.2081,63.9706);
    return 1;
    }
        else if (dini_Int(file, "team") == 8) {
    SetPlayerPos(playerid, -314.2366,1774.3470,43.6406);
    return 1;
    }
        else if (dini_Int(file, "team") == 9) {
    SetPlayerPos(playerid, 263.1817,21.6686,3.4332);
    return 1;
    }
    return 1;
}
But it doesnt spawn me at the places i defines.
Whats wrong?
Reply
#2

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new file[256], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "Users/%s.ini", pname);
new t=dini_Int(file, "team");

    if (t == 1) {
SetPlayerPos(playerid,-217.4578,978.8492,19.5014);
GivePlayerWeapon(playerid, 24, 250);
return 1;
}
 else if (t == 2) {
SetPlayerPos(playerid,-320.0699,1048.6085,20.3403);
return 1;
}
  else if (t == 3) {
SetPlayerPos(playerid, -73.5261,16.3937,5.9605);
return 1;
}
  else if (t == 4) {
SetPlayerPos(playerid, -136.2579,1116.7528,20.1966);
return 1;
}
  else if (t == 5) {
SetPlayerPos(playerid, -370.5210,1167.1810,20.2719);
return 1;
}
else if (t == 6) {
SetPlayerPos(playerid, 106.6390,-182.9938,1.4942);
return 1;
}
else if (t == 7) {
SetPlayerPos(playerid, 870.1599,-25.2081,63.9706);
return 1;
}
 else if (t == 8) {
SetPlayerPos(playerid, -314.2366,1774.3470,43.6406);
return 1;
}
else if (t == 9) {
SetPlayerPos(playerid, 263.1817,21.6686,3.4332);
return 1;
}
return 1;
}
Try this.
Reply
#3

Same shit, I'm going to start panic
Reply
#4

Quote:

public OnPlayerRequestSpawn(playerid)

If you are requesting to be spawned then you have no position, move the code to "OnPlayerSpawn".

Also I'd just like to point out that you are going to be reading a file each time you request a spawn, this is very stupid (the method not you dude) and if you are going to use files then use buffers like I do in THIS script. I have a buffer in there which holds all the players data which is collected once from the file and then the buffer data is used instead of opening/reading/closing the file each time I want some data.
Reply
#5

Ok, i'll try,
And thanks for the information, i'll try to fix it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)