[Include] YSI 4
#21

Quote:
Originally Posted by PT
Посмотреть сообщение
That update was ****** who did?
We do not speak of this here.

It wasn't him who did, but he may have CONTRIBUTED as it says.
Reply
#22

How do i include this
Reply
#23

Quote:
Originally Posted by sammp
Посмотреть сообщение
How do i include this
You just include the parts that you want. For example, if you want to use YCMD:

#include <YSI\y_commands>
Reply
#24

I decided to update to YSI 4.0 and when i did i ran in to some problems while compiling

Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(229) : error 025: function heading differs from prototype
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1329) : error 021: symbol already defined: "@yH_OnScriptInit@003"
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1330) : error 021: symbol already defined: "@yH_OnScriptInit@003"
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1369) : warning 209: function "@yH_OnScriptInit@003" should return a value
C:\Users\Win7\Desktop\Sa-mp 0.3.7\gamemodes\wip.pwn(1654) : error 025: function heading differs from prototype
Line 1654
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
I just use y_commands and y_iterate
Reply
#25

Solve it with:
Код:
/*
    List of enum:
	// The majority of these are even - odd numbers return "1" not "0".
	COMMAND_ZERO_RET      = 0 , // The command returned 0.
	COMMAND_OK            = 1 , // Called corectly.
	COMMAND_UNDEFINED     = 2 , // Command doesn't exist.
	COMMAND_DENIED        = 3 , // Can't use the command.
	COMMAND_HIDDEN        = 4 , // Can't use the command don't let them know it exists.
	COMMAND_NO_PLAYER     = 6 , // Used by a player who shouldn't exist.
	COMMAND_DISABLED      = 7 , // All commands are disabled for this player.
	COMMAND_BAD_PREFIX    = 8 , // Used "/" instead of "#", or something similar.
	COMMAND_INVALID_INPUT = 10, // Didn't type "/something".
*/
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success); 
{
    switch(success)
    {
        // case bla bla:
        /*
        Example:
        case  COMMAND_DENIED:
        {
            Ban(playerid); // Ban them because using our secret command >_< lol
        }
        */
    }
    return COMMAND_OK;
}
Quote:
Originally Posted by ihatetn931
Посмотреть сообщение
I decided to update to YSI 4.0 and when i did i ran in to some problems while compiling

Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(229) : error 025: function heading differs from prototype
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1329) : error 021: symbol already defined: "@yH_OnScriptInit@003"
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1330) : error 021: symbol already defined: "@yH_OnScriptInit@003"
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1369) : warning 209: function "@yH_OnScriptInit@003" should return a value
C:\Users\Win7\Desktop\Sa-mp 0.3.7\gamemodes\wip.pwn(1654) : error 025: function heading differs from prototype
Line 1654
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
I just use y_commands and y_iterate
Reply
#26

That fixed the function heading differs problem, but i still have this issue. I've done ****** searching and came up with the issue no where, just bring me back to my post

Код:
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1329) : error 021: symbol already defined: "@yH_OnScriptInit@003"
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1330) : error 021: symbol already defined: "@yH_OnScriptInit@003"
C:\Users\Win7\Desktop\sa-mp 0.3.7\pawno\include\YSI\..\YSI_Visual\y_commands/impl.inc(1369) : warning 209: function "@yH_OnScriptInit@003" should return a value
Reply
#27

Can i see your OnFilterScriptInit or OnGameModeInit?
Reply
#28

pawn Код:
public OnGameModeInit()
{
    #include "../gamemodes/RPG/objects.pwn"
    #include "../gamemodes/RPG/buildings.pwn"
    ManualVehicleEngineAndLights();
    DisableInteriorEnterExits();
    mysql_log(LOG_ERROR | LOG_WARNING,LOG_TYPE_HTML);
    dbHandle = mysql_connect("127.0.0.1","username","database","password");
    if(mysql_errno() != 0)
    {
        print("Mysql Failed\n");
    }
    else
    {
        print("Mysql Success\n");
    }
    UsePlayerPedAnims();
    SetGameModeText("WIP");
    SendRconCommand("mapname WIP");
    //Timers
    SetTimer("NitroReset", 3000, 1);
    LoadAll();
    printf("Bulldings Removed %d\n", CountRemovedObjects());

    textDrawsGlobal();

    WorldTime = SetTimer("UpdateWTime", 1000, true);

    skinlist = LoadModelSelectionMenu("skins.txt");
    vehiclelist = LoadModelSelectionMenu("vehicles.txt");

    for(new v=0; v<MAX_VEHICLES; v++)
    {
        Vehicle_ReadPosition(v);
    }
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        textDrawsPlayers(i);
    }
    return 1;
}
Reply
#29

Thanks for re-post!
Reply
#30

Don't use Iter_Remove within foreach loop! Use Iter_SafeRemove (in your code it would be
pawn Код:
Iter_SafeRemove(Jobs, i, i);
Quote:

<summary>Iter_SafeRemove</summary>
<param name="iter">Name of the iterator to remove data from.</param>
<param name="value">Data to remove.</param>
<param name="next">Container for the pointer to the next element.</param>
<returns>
-
</returns>
<remarks>
Wrapper for Iter_SafeRemoveInternal. Common use:

Iter_SafeRemove(iter, i, i);

native Iter_SafeRemove(Iterator:Name<>, value, &next);

</remarks>

Reply
#31

Is it necessary if i'm breaking the loop just after removing the value from the iterator?
Reply
#32

Quote:
Originally Posted by kvann
Посмотреть сообщение
Is it necessary if i'm breaking the loop just after removing the value from the iterator?
Yes. If you don't do it you will still receive errors. Why is it such a big concern anyways? It's just a tad bit more typing.
Reply
#33

Quote:
Originally Posted by kvann
Посмотреть сообщение
Is it necessary if i'm breaking the loop just after removing the value from the iterator?
Quote:
Originally Posted by Crayder
Посмотреть сообщение
Yes. If you don't do it you will still receive errors. Why is it such a big concern anyways? It's just a tad bit more typing.
No, it isn't necessary only for one value. For more values it's necessary, but only for one it isn't.
Reply
#34

pawn Код:
CMD:removeallcars(playerid)
{
    foreach (new i : Vehicle) DestroyVehicle(i);
    SendClientMessage(playerid, 0xFFFFFFFF, "All vehicles destroyed!");
    return 1;
}
Using default iterators is resulting in server freeze because of the same thing: http://forum.sa-mp.com/showpost.php?...3&postcount=61 I guess I could temporarily fix it with a timer but I'd like to see a solution for it.
Reply
#35

Quote:
Originally Posted by kvann
Посмотреть сообщение
pawn Код:
CMD:removeallcars(playerid)
{
    foreach (new i : Vehicle) DestroyVehicle(i);
    SendClientMessage(playerid, 0xFFFFFFFF, "All vehicles destroyed!");
    return 1;
}
Using default iterators is resulting in server freeze because of the same thing: http://forum.sa-mp.com/showpost.php?...3&postcount=61 I guess I could temporarily fix it with a timer but I'd like to see a solution for it.
The solution is the same as the above, SafeRemove. Of course you need to store the ID and remove the vehicle AFTER removing from the iterator like this:
pawn Код:
stock SafeDestroyVehicle(veh, Iterator:iter<>, &next)
{
    if(IsValidVehicle(veh))
        Iter_SafeRemove(iter, veh, next);
    return DestroyVehicle(veh);
}

//USE:
foreach (new i : Vehicle) SafeDestroyVehicle(i, Vehicle, i);
This SHOULD work. It may require a custom vehicle iterator, but it shouldn't because we are actually tricking y_iterate here (since DestroyVehicle is also going to call Iter_Remove, but Iter_Remove won't be receiving a valid vehicle ID because we already removed it).
Reply
#36

When i try to use function Text_MessageBox i receive the following errors:
Код HTML:
Carabines.pwn(272) : error 017: undefined symbol "DEFAULT_TEXT_SET"
Carabines.pwn(272) : error 017: undefined symbol "FIFTH_CHECKPOINT_DMV_DIALOG"
Carabines.pwn(272) : error 029: invalid expression, assumed zero
Carabines.pwn(272) : fatal error 107: too many error messages on one line
Line 272:
Quote:

Text_MessageBox(playerid, using inline OnDMVDialog, $DMV_DIALOG_TITLE, $FIFTH_CHECKPOINT_DMV_DIALOG, $DIALOGS_OK, $DIALOGS_CANCEL);

The whole function:
Quote:

FUNCTION:SetPlayerDMVCheckpoint(playerid, CP)
{
if(CP < 16)
{
inline OnDMVDialog(pid, dialogid, response, listitem, string:inputtext[])
{
// some code
return 1;
}
//SetPlayerRaceCheckpointEx(playerid, 0,DMV_CHECKPOINT[CP][0], DMV_CHECKPOINT[CP][1], DMV_CHECKPOINT[CP][2], DMV_CHECKPOINT[CP+1][0], DMV_CHECKPOINT[CP+1][1], DMV_CHECKPOINT[CP+1][2], 5, CP);
if(CP == 5)
{
Text_MessageBox(playerid, using inline OnDMVDialog, $DMV_DIALOG_TITLE, $FIFTH_CHECKPOINT_DMV_DIALOG, $DIALOGS_OK, $DIALOGS_CANCEL);
}
else if(CP == 10)
Text_Send(playerid, $TENTH_CHECKPOINT_DMV);
}
else
SetPlayerCheckpointEx(playerid, DMV_CHECKPOINT[CP][0], DMV_CHECKPOINT[CP][1], DMV_CHECKPOINT[CP][2], 5, CP);
return 1;
}

Reply
#37

Hello.

I'd like to follow up on this.

Quote:
Originally Posted by ZZ
Посмотреть сообщение
Hi guys!

Seems like there is one more issue.

In y_commands method Command_SetDeniedReturn() is not working.

Trunk version.

Код:
#include <YSI\y_commands>

public OnPlayerConnect (playerid) {

Command_SetDeniedReturn(false);

return 1;
}
error 017: undefined symbol "Command_SetDeniedReturn"
Reply
#38

For people with issue like @andyandyy8 - I merged @PatchwerkQWER patch into upstream.

@ZZ: It seems it wasn't ported properly. Could you open an issue on github? I'll bring back the old verison when I read what happened recently with y_commands.

@All:
Currently I'm investigating https://github.com/Misiur/YSI-Includ...ment-115822235 this - y_malloc issue causes problems in inline functions, so mysql and dialogs are affected. If anybody can lend me a hand I'd really appreciate. When fixed I'll post here.

Also, is creating a release tag tarball with amx included a good idea?
Reply
#39

Fixed the memory problem, and pushed onto server. Might fix random hangups.
Reply
#40

Help needed....
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)