14.10.2011, 15:23
I use this, now I am confused
So where to put it
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
//save the name of your folder in scriptfiles
format(file, sizeof(file), "\\Save\\%s.ini", pname);
if(!dini_Exists(file))
dini_Create(file);
dini_IntSet(file, "skin", GetPlayerSkin(playerid));
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "color", GetPlayerColor(playerid));
KillTimer(timer);
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) { //Checks if the player that just spawned is an NPC.
new npcname[MAX_PLAYER_NAME];
//Getting the NPC's name.
GetPlayerName(playerid, npcname, sizeof(npcname));
//Checking if the NPC's name is Taxi_Driver
if(!strcmp(npcname, "Taxi_Driver", true)) {
//Putting the NPC into the vehicle we created for it.
PutPlayerInVehicle(playerid, Taxi_DriverVehicle, 0);
SetPlayerSkin(playerid,141);
SetPlayerColor(playerid,COLOR_YELLOW);
}
//Checking if the NPC's name is Harry_Potter
if(!strcmp(npcname, "Harry_Potter", true)) {
//Putting the NPC into the vehicle we created for it.
PutPlayerInVehicle(playerid, Harry_PotterVehicle, 0);
SetPlayerSkin(playerid,147);
SetPlayerColor(playerid,COLOR_WHITE);
}
return 1;
}
SetPlayerInterior(playerid,0);
SetPlayerRandomSpawn(playerid);
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 26, 999);
GivePlayerWeapon(playerid, 21, 999);
GivePlayerMoney(playerid, 50000);
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Save\\%s.ini", pname);
if(dini_Exists(file)) {
SetTimerEx("SpawnSave", 10, false, "d", playerid);
}
return 1;
}
pawn Код:
forward SpawnSave(playerid);
public SpawnSave(playerid)
{
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Save\\%s.ini", pname);
SetPlayerSkin(playerid, dini_Int(file, "skin"));
SetPlayerScore(playerid, dini_Int(file, "score"));
SetPlayerColor(playerid, dini_Int(file, "color"));
return 1;
}