i'ts not work good
#6

Quote:
Originally Posted by AdrianG
Посмотреть сообщение
have you tried to print the Pos array, in order to see where is the problem..!? try to print it in the while loop.
Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Code looks fine, nothing wrong with it (except IsPlayerInArea function but that is custom so its probably fine)

Please how us IsPlayerInArea function (how its defined). And file format how you save that coordinates (what each one is representing)
Quote:
Originally Posted by Sithis
Посмотреть сообщение
What's not working well? Do you get any errors? Does the file exist and contain the right values? You really must be more specific!
PHP код:
new
    
Float:AreaInfo[6];
YCMD:areaweapon(playeridparams[], help)
{
    
#pragma unused params, help
    
return ShowPlayerDialog(playeridDIALOG_IPIA_MAKERDIALOG_STYLE_LIST"יוצר אזורים דינאמי""שמירת קצה ראשון\nשמירת קצה שני\n{F58282}שמירת אזור במערכת\nאיפוס שמירת קצוות""בחירה""יציאה"), 1;
}
public 
OnFilterScriptInit()
{
    
SetTimer("InAreaCheck"200true);
    return 
1;
}
function 
InAreaCheck()
{
    new 
File:file fopen("IsPlayerInArea.ini"io_read);
    if (!
file) return 0;
    new 
line[MAX_AREAS],
        
Float:Pos[6];
    while (
fread(fileline))
    {
        
sscanf(line"p<,>ffffff"Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5]);
        
printf("%f, %f, %f, %f, %f, %f"Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5]);
        for(new 
i<MAX_PLAYERSi++) if(IsPlayerConnected(i) && IsPlayerInArea(iPos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5]))
        {
            
SendClientMessage(i0xFF0000FF".!אתה נמצא באזור זה");
        }
    }
    
fclose(file);
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch (
dialogid)
    {
        case 
DIALOG_IPIA_MAKER:
        {
            if(!
response) return 0;
            switch(
listitem)
            {
                case 
0:
                {
                    
GetPlayerPos(playeridAreaInfo[0], AreaInfo[1], AreaInfo[2]);
                    
SendClientMessage(playerid0xCC9900FF"[Area Dynamic]: .קצה ראשון נשמר בהצלחה");
                }
                case 
1:
                {
                    
GetPlayerPos(playeridAreaInfo[3], AreaInfo[4], AreaInfo[5]);
                    
SendClientMessage(playerid0xCC9900FF"[Area Dynamic]: .קצה שני נשמר בהצלחה");
                }
                case 
2:
                {
                    if(!
response) return ShowPlayerDialog(playeridDIALOG_IPIA_MAKERDIALOG_STYLE_LIST"יוצר אזורים דינאמי""שמירת קצה ראשון\nשמירת קצה שני\n{F58282}שמירת אזור במערכת\nאיפוס שמירת קצוות""בחירה""יציאה"), 1;
                    if(!
IsUseOne() && !IsUseTwo()) return SendClientMessage(playerid0xFF0000FF"[Area Dynamic]: .עלייך לשמור שני קצוות");
                    new 
string[128];
                    
format(stringsizeof(string), "%f, %f, %f, %f, %f, %f\r\n",
                        (
AreaInfo[0] < AreaInfo[3]) ? AreaInfo[0] : AreaInfo[3],
                        (
AreaInfo[1] < AreaInfo[4]) ? AreaInfo[1] : AreaInfo[4],
                        (
AreaInfo[2] < AreaInfo[5]) ? AreaInfo[2] : AreaInfo[5],
                        (
AreaInfo[0] > AreaInfo[3]) ? AreaInfo[0] : AreaInfo[3],
                        (
AreaInfo[1] > AreaInfo[4]) ? AreaInfo[1] : AreaInfo[4],
                        (
AreaInfo[2] > AreaInfo[5]) ? AreaInfo[2] : AreaInfo[5]
                    );
                    new 
File:pos=fopen("IsPlayerInArea.ini"io_append);
                    
fwrite(posstring);
                    
fclose(pos);
                    new 
dialogstring[128];
                    
format(dialogstringsizeof(dialogstring), "\nIsPlayerInArea saved under the name {F58282}IsPlayerInArea_%s.ini {a9c4e4}inside the scriptfiles folder!\n"inputtext);
                    
ShowPlayerDialog(playerid206DIALOG_STYLE_MSGBOX" "dialogstring"Exit""");
                    
ResetAll();
                }
                default:
                {
                    if(!
IsUseOne() && !IsUseTwo()) return SendClientMessage(playerid0xFF0000FF"[Area Dynamic]: .עלייך לשמור שני קצוות");
                    
ResetAll();
                    
SendClientMessage(playerid0xCC9900FF"[Area Dynamic]: .שמירת הקצוות אופסו בהצלחה");
                }
            }
        }
    }
    return 
1;
}
IsUseOne()
    return 
AreaInfo[0] != 0.0 true:false;
    
IsUseTwo()
    return 
AreaInfo[3] != 0.0 true:false;
IsPlayerInArea(playeridFloat:MinXFloat:MinYFloat:MinZ,Float:MaxXFloat:MaxY,Float:MaxZ)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    return (
>= MinX && <= MaxX && >= MinY && <= MaxY  && >= MinZ && <= MaxZ) ? 0;

i'ts all code, please help me fix the problem ...
Reply


Messages In This Thread
i'ts not work good - by _Application_ - 23.05.2016, 16:08
Re: i'ts not work good... =/ help please! - by Sithis - 23.05.2016, 17:01
Re: i'ts not work good... =/ help please! - by DRIFT_HUNTER - 23.05.2016, 17:12
Re: i'ts not work good... =/ help please! - by _Application_ - 23.05.2016, 18:28
Re: i'ts not work good... =/ help please! - by AdrianG - 23.05.2016, 21:39
Re: i'ts not work good... =/ help please! - by _Application_ - 24.05.2016, 13:40
Re: i'ts not work good... =/ help please! - by JasperM - 24.05.2016, 14:32
Re: i'ts not work good... =/ help please! - by _Application_ - 25.05.2016, 06:51

Forum Jump:


Users browsing this thread: 1 Guest(s)