Faction cars and Saving player posistion.
#1

I am using the Base Server Game mode that Conroy released to help stop godfather edits. So far I have figured out how to lock the vehicle I made for the different factions.

pawn Код:
faction4car[AddStaticVehicle(470,2757.9487,-2387.6030,13.6255,179.1758,1,1)] = true;
that should lock it right?

Then I need to unlock the vehicle for just that faction, so I think something like
pawn Код:
if(Member[playerid] == 4)
{
faction4car = false;
}
Now I have not tried it as of yet. But from my experience these last few weeks, while I have been making this non-godfather related RP Gamemode, nothing is as simple as it seems. So any advice on how to do this or even a better way, would be much appreciated.

Also I want to leave the Vehicle model open for the random car spawn system I scripted in.


Now I also have an issue with my Player position saving system it worked fine on my normal testing with a blank gamemode, but when i implemented it, players end up spawning at random areas or at the first spawn position. Here is how i wrote it.
pawn Код:
public OnPlayerDisconnect(playerid)
{
  new name[MAX_PLAYER_NAME], string[48];
  GetPlayerName(playerid, name, sizeof(name));
  format(string, sizeof(string), "%s has left %s.", name, ServerName);
  SendClientMessageToAll(COLOR_GREY, string);
    format(file, sizeof(file), USERS_FILE, PlayerName(playerid));{
    GetPlayerPos(playerid, PlayerInfo[playerid][x], PlayerInfo[playerid][y], PlayerInfo[playerid][z]);
    GetPlayerFacingAngle(playerid, PlayerInfo[playerid][a]);
    dini_FloatSet(file, "X", PlayerInfo[playerid][x]);
    dini_FloatSet(file, "Y", PlayerInfo[playerid][y]);
    dini_FloatSet(file, "Z", PlayerInfo[playerid][z]);
    dini_FloatSet(file, "A", PlayerInfo[playerid][a]);
    dini_IntSet(file, "Int", GetPlayerInterior(playerid));
        }
  return 1;
}
then in OnPlayerSpawn.
pawn Код:
{
  new string[128];
  format(string, sizeof(string), "Position and Money returned.", GetPlayerMoney(playerid));
  SendClientMessage(playerid, COLOR_WHITE, string);
  if dini_Exists(file[playerid]) *then
  {
    if(dini_Float(file, "X") == 0 && dini_Float(file, "Y") == 0 && dini_Float(file, "Z") == 0) return 1;
    SetPlayerPos(playerid, dini_Float(file, "X"), dini_Float(file, "Y"), dini_Float(file, "Z"));
    SetPlayerFacingAngle(playerid, dini_Float(file, "A"));
    SetPlayerInterior(playerid, dini_Int(file, "Int"));
    }
    else {
    dini_Create(file);
    dini_IntSet(file, "X", 0);
    dini_IntSet(file, "Y", 0);
    dini_IntSet(file, "Z", 0);
    dini_IntSet(file, "A", 0);
    dini_IntSet(file, "Int", 0);
    }
  return 1;
}
i did it this way because the Original login/register I removed when I sat down and wrote a Admin FS that I stupidly made use Dudb instead of Dini, and I put the login/register commands in that.
Reply


Messages In This Thread
Faction cars and Saving player posistion. - by MichalGusta - 10.04.2010, 10:38
Re: Faction cars and Saving player posistion. - by MichalGusta - 10.04.2010, 20:56
Re: Faction cars and Saving player posistion. - by Steven82 - 10.04.2010, 20:58
Re: Faction cars and Saving player posistion. - by MichalGusta - 10.04.2010, 21:01

Forum Jump:


Users browsing this thread: 1 Guest(s)