y_ini Help
#1

Hi, i've been using dini in my FS but now I'm trying to learn y_ini, i've followed some tutorials but am now experiencing problems. I get the following errors...

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(292) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(293) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(296) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(297) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(298) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(299) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\s-admin.pwn(300) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Warnings.
The lines are...

Код:
(292)	SetPlayerInterior( playerid, Interior [ playerid ] );
(293)	SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
(296)	SetPlayerSkin( playerid, Skin[ playerid ] );
(297)  	SetPlayerMoney( playerid, Money[ playerid ] );
(298)  	SetPlayerWantedLevel( playerid, WantedLevel[ playerid ] );
(299)  	SetPlayerFightingStyle( playerid, FightingStyle[ playerid ] );
(300)  	SetPlayerScore( playerid, Points[ playerid ] );
The complete code is... public OnPlayerSpawn(playerid)

Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
	SetPlayerFacingAngle( playerid, Angle[ playerid ] );
	SetPlayerInterior( playerid, Interior [ playerid ] );
	SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
	SetPlayerHealth( playerid, Health[ playerid ] );
	SetPlayerArmour( playerid, Armour[ playerid ] );
	SetPlayerSkin( playerid, Skin[ playerid ] );
   	SetPlayerMoney( playerid, Money[ playerid ] );
   	SetPlayerWantedLevel( playerid, WantedLevel[ playerid ] );
   	SetPlayerFightingStyle( playerid, FightingStyle[ playerid ] );
   	SetPlayerScore( playerid, Points[ playerid ] );
	return 1;
}
Please help me learn how to prevent these problems.
Reply
#2

Why do you have everything so spaced out?
Reply
#3

Quote:
Originally Posted by Akira297
Посмотреть сообщение
Why do you have everything so spaced out?
Becuase then its better to see what is going on , saw it in a tutorial and thought it looked good as it makes thing clearer.
Reply
#4

Код:
SetPlayerInterior(playerid, 0); // Interior
SetPlayerVirtualWorld(playerid, 0); //VW
SetPlayerSkin(playerid, 0); //Skin
GivePlayerCash(giveplayerid, money); // Money
SetPlayerWantedLevel(playerid, 0) // Wanted
SetPlayerFightingStyle(giveplayerid, fightstyle); // Fighting Style
SetPlayerScore(giveplayerid, PlayerInfo[giveplayerid][pLevel]); // <-- MIGHT NOT WORK. This is my Variable for PlayerScore
Reply
#5

Quote:
Originally Posted by Akira297
Посмотреть сообщение
Код:
SetPlayerInterior(playerid, 0); // Interior
SetPlayerVirtualWorld(playerid, 0); //VW
SetPlayerSkin(playerid, 0); //Skin
GivePlayerCash(giveplayerid, money); // Money
SetPlayerWantedLevel(playerid, 0) // Wanted
SetPlayerFightingStyle(giveplayerid, fightstyle); // Fighting Style
SetPlayerScore(giveplayerid, PlayerInfo[giveplayerid][pLevel]); // <-- MIGHT NOT WORK. This is my Variable for PlayerScore
What i'm doing with my code is to get the data from a file, so when a player logs back into the game they are spawned where they last logged out, not sure if the code correction you gave me will accomplish that. Please rectify me if i'm wrong.
Reply
#6

Show the definition of the variables that are giving you the errors.
Reply
#7

Код:
SetPlayerInterior( playerid, PlayerInfo[playerid][Interior]);
etPlayerVirtualWorld( playerid, PlayerInfo[playerid][VirtualWorld]);
SetPlayerSkin( playerid, PlayerInfo[playerid][Skin]);
SetPlayerMoney( playerid, PlayerInfo[playerid][Money]);
SetPlayerWantedLevel( playerid, PlayerInfo[playerid][WantedLevel]);
SetPlayerFightingStyle( playerid, PlayerInfo[playerid][FightingStyle]);
SetPlayerScore( playerid, PlayerInfo[playerid][Points]);
Try This Codes
Reply
#8

Quote:
Originally Posted by Orhun_Kaya
Посмотреть сообщение
Код:
SetPlayerInterior( playerid, PlayerInfo[playerid][Interior]);
etPlayerVirtualWorld( playerid, PlayerInfo[playerid][VirtualWorld]);
SetPlayerSkin( playerid, PlayerInfo[playerid][Skin]);
SetPlayerMoney( playerid, PlayerInfo[playerid][Money]);
SetPlayerWantedLevel( playerid, PlayerInfo[playerid][WantedLevel]);
SetPlayerFightingStyle( playerid, PlayerInfo[playerid][FightingStyle]);
SetPlayerScore( playerid, PlayerInfo[playerid][Points]);
Try This Codes
Reply
#9

Ok Here is the code like it is in my script...

Код:
#include <YSI/y_ini>//At the top of my script


new
Float: PosX[ MAX_PLAYERS ],
Float: PosY[ MAX_PLAYERS ],
Float: PosZ[ MAX_PLAYERS ],
Float: Angle[ MAX_PLAYERS ],
Float: Interior[ MAX_PLAYERS ],
Float: VirtualWorld[ MAX_PLAYERS ],
Float: Health[ MAX_PLAYERS ],
Float: Armour[ MAX_PLAYERS ],
Float: Skin[ MAX_PLAYERS ],
Float: Money[ MAX_PLAYERS ],
Float: FightingStyle[ MAX_PLAYERS ],
Float: WantedLevel[ MAX_PLAYERS ],
Float: Points[ MAX_PLAYERS ]
;

stock user_ini_file(playerid)
{
    new
    string[ 128 ],
    user_name[ MAX_PLAYER_NAME ]
    ;

    GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
    format( string, sizeof ( string ), "%s.ini", user_name );
    /* scriptfiles directory */
    return
    string;
}

public OnPlayerConnect(playerid)
{

    PosX[ playerid ] = 0;
    PosY[ playerid ] = 0;
    PosZ[ playerid ] = 0;
    Angle[ playerid ] = 0;
    Interior[ playerid ] = 0;
    VirtualWorld[ playerid ] = 0;
    Health[ playerid ] = 0;
    Armour[ playerid ] = 0;
    Skin[ playerid ] = 0;
    Money[ playerid ] = 0;
    FightingStyle[ playerid ] = 0;
    WantedLevel[ playerid ] = 0;
    Points[ playerid ] = 0;

    INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
    return 1;
}

public OnPlayerConnect(playerid)
{

    PosX[ playerid ] = 0;
    PosY[ playerid ] = 0;
    PosZ[ playerid ] = 0;
    Angle[ playerid ] = 0;
    Interior[ playerid ] = 0;
    VirtualWorld[ playerid ] = 0;
    Health[ playerid ] = 0;
    Armour[ playerid ] = 0;
    Skin[ playerid ] = 0;
    Money[ playerid ] = 0;
    FightingStyle[ playerid ] = 0;
    WantedLevel[ playerid ] = 0;
    Points[ playerid ] = 0;

    INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
    SetPlayerFacingAngle( playerid, Angle[ playerid ] );
    SetPlayerInterior( playerid, Interior [ playerid ] );
    SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
    SetPlayerHealth( playerid, Health[ playerid ] );
    SetPlayerArmour( playerid, Armour[ playerid ] );
    SetPlayerSkin( playerid, Skin[ playerid ] );
    SetPlayerMoney( playerid, Money[ playerid ] );
    SetPlayerWantedLevel( playerid, WantedLevel[ playerid ] );
    SetPlayerFightingStyle( playerid, FightingStyle[ playerid ] );
    SetPlayerScore( playerid, Points[ playerid ] );
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{

    GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
    GetPlayerFacingAngle( playerid, Angle[ playerid ] );

    new INI:File = INI_Open( user_ini_file( playerid ) );
    INI_SetTag( File, "position" );
    INI_WriteFloat(File, "PosX", PosX[ playerid] );
    INI_WriteFloat(File, "PosY", PosY[ playerid] );
    INI_WriteFloat(File, "PosZ", PosZ[ playerid] );
    INI_WriteFloat(File, "Angle", Angle[ playerid] );
    INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) );
    INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) );
    INI_WriteFloat(File, "Health", Health[ playerid] );
    INI_WriteFloat(File, "Armour", Armour[ playerid] );
    INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));
    INI_WriteInt(File, "Money", GetPlayerMoney(playerid));
    INI_WriteInt(File, "WantedLevel", GetPlayerWantedLevel(playerid));
    INI_WriteInt(File, "FightingStyle", GetPlayerFightingStyle(playerid));
    INI_WriteInt(File, "Level", GetPlayerScore(playerid));
    INI_Close( File );
    return 1;
}
Keep in mind, i'm familiar with dini and is still learning y_ini (because its faster)
Reply
#10

Quote:
Originally Posted by Orhun_Kaya
Посмотреть сообщение
Код:
SetPlayerInterior( playerid, PlayerInfo[playerid][Interior]);
etPlayerVirtualWorld( playerid, PlayerInfo[playerid][VirtualWorld]);
SetPlayerSkin( playerid, PlayerInfo[playerid][Skin]);
SetPlayerMoney( playerid, PlayerInfo[playerid][Money]);
SetPlayerWantedLevel( playerid, PlayerInfo[playerid][WantedLevel]);
SetPlayerFightingStyle( playerid, PlayerInfo[playerid][FightingStyle]);
SetPlayerScore( playerid, PlayerInfo[playerid][Points]);
Try This Codes
Gives me an error that sais "error 033: array must be indexed (variable "Interior")"

PS: I only tried it on the interior to see if it does fix the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)