11.12.2014, 17:23
Anyway, now I started from 0 with Pickups:
All code, now it's workin' fine, but isn't loaded In-Game. What problem have above script?
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <YSI\y_ini>
#define PATH "/Pickups/%d.ini"
enum pInfo
{
Float:pX,
Float:pY,
Float:pZ,
pID,
}
new Pick[MAX_PLAYERS][pInfo];
new pickups;
public OnPlayerConnect(playerid)
{
INI_ParseFile(PickPath(pickups), "LoadPickup_%s", .bExtra = true, .extra = playerid);
return 1;
}
CMD:createpick(playerid, params[])
{
new Pickup, string[128], Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(sscanf(params,"i", Pickup)) return SendClientMessage(playerid, -1, "{FFCC33}USAGE: {15FF00}/CreatePick [Pick-up ID]");
format(string, sizeof(string), "{FFCC33}Pick-up {FF0000}%d {FFCC33}|| Pick-up ID: {FF0000}%i {FFCC33}was created.", pickups, Pickup);
SendClientMessage(playerid, -1, string);
pickups++;
CreatePickup(Pickup, 1, X, Y, Z, -1);
new INI:File = INI_Open(PickPath(pickups));
INI_SetTag(File,"HY's Dynamic Pickups");
INI_WriteInt(File,"Pick-up ID", Pickup);
INI_WriteFloat(File,"Pick-up X", X);
INI_WriteFloat(File,"Pick-up Y", Y);
INI_WriteFloat(File,"Pick-up Z", Z);
INI_Close(File);
Pick[playerid][pX] = X;
Pick[playerid][pY] = Y;
Pick[playerid][pZ] = Z;
Pick[playerid][pID] = Pickup;
return 1;
}
stock PickPath(pickups)
{
new string[128];
format(string,sizeof(string),PATH,pickups);
return string;
}
forward LoadPickup_data(playerid,name[],value[]);
public LoadPickup_data(playerid,name[],value[])
{
INI_Int("pID",Pick[playerid][pID]);
INI_Float("pX",Pick[playerid][pX]);
INI_Float("pY",Pick[playerid][pY]);
INI_Float("pY",Pick[playerid][pZ]);
return 1;
}