SA-MP Forums Archive
Help please. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help please. (/showthread.php?tid=60447)



Help please. - rafay - 04.01.2009

pawn Code:
public OnPlayerConnect()
{
  new file[256], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "/applies/%s.ini", pname);
  if(dini_Exists(file)) return SendClientMessage(playerid, red, "You have already made your application!");
  format(file, sizeof(file), "/applies/%s.ini", pname);
  if (!fexist(file)) return SendClientMessage(playerid,green,"Wanna apply for Administrator ? Type /aa for a IN-GAME Admin Apply!!");
  return 1;
}
Why it doesn't works ?
It doesn't displays a message when a playername.ini exists, even doesn't displays a when playername.ini doesn't exists D:
Also it gives 3 errors about Undefined Symbol "playerid"'

Help please ? zezombia ?


Re: Help please. - Zezombia - 04.01.2009

Your getting playerid errors because it's not defined. Change the callback to:
pawn Code:
public OnPlayerConnect(playerid)
You don't need to format "file" twice, just delete the second time.

See if that helps, then report back.


Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Zezombia
Your getting playerid errors because it's not defined. Change the callback to:
pawn Code:
public OnPlayerConnect(playerid)
You don't need to format "file" twice, just delete the second time.

See if that helps, then report back.
Thanks for that playerid error.
but it still doesn't returns any message:

pawn Code:
public OnPlayerConnect(playerid)
{
  new file[256], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "/applies/%s.ini", pname);
  if(dini_Exists(file)) return SendClientMessage(playerid, red, "You have already made your application!");
  if (!fexist(file)) return SendClientMessage(playerid,green,"Wanna apply for Administrator ? Type /aa for a IN-GAME Admin Apply!!");
  return 1;
}
something to do with fexist, dini_Exists ?
i don't know much about dini, dudb etc.


Re: Help please. - Zezombia - 04.01.2009

Me nether, but you could always change:
pawn Code:
if (!fexist(file))
to:
pawn Code:
if(!dini_Exists(file))
And see if that helps you any. I think that default functions use "//" not "/" to change folders.


Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Zezombia
Me nether, but you could always change:
pawn Code:
if (!fexist(file))
to:
pawn Code:
if(!dini_Exists(file))
And see if that helps you any. I think that default functions use "//" not "/" to change folders.
still doesn't works.


Re: Help please. - Zezombia - 04.01.2009

Well I wasn't gonna mention this because I thought I was missing something but:

What about the fact that your not actually writing anything to a file? Your only checking if it exists.


Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Zezombia
Well I wasn't gonna mention this because I thought I was missing something but:

What about the fact that your not actually writing anything to a file? Your only checking if it exists.
it will write in the file when the player types the command (/aa)



Re: Help please. - Zezombia - 04.01.2009

Could I see that code please? It's probably something to do with creating the file, not checking it.


Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Zezombia
Could I see that code please? It's probably something to do with creating the file, not checking it.
I haven't written the code yet, im trying to solve the checking for the file & displaying the message problem.. D:

but here you go:

pawn Code:
/*============================================
Admin Application IN-GAME FilterScript!    |
Made by Rafay!                               |
If you use it, Please give me some credits   |
                                             |
==============================================*/


//[Includes]
#include <a_samp>
#include <dudb>
#include <dini>

#pragma unused ret_memcpy

//[Defines]
#define green 0x33AA33AA
#define red 0xAA3333AA
#define blue 0x0000BBAA

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Admin Application IN-GAME Loaded!");
    print("--------------------------------------\n");
    return 1;
}

public OnPlayerConnect(playerid)
{
  new file[256], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "/applies/%s.ini", pname);
  if(!dini_Exists(file)) return SendClientMessage(playerid, red, "You have already made your application!");
    if (!fexist(file)) return SendClientMessage(playerid,green,"Wanna apply for Administrator ? Type /aa for a IN-GAME Admin Apply!!");
  return 1;
}



Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Seif_
Does the folder "applies" even exist? And decrease the array size from 256 to 64 at least...
yes the folder exists, & decreasing the size will solve the problem ?


Re: Help please. - Zezombia - 04.01.2009

He says that it doesn't display both ways. If Seif_'s code works, then wouldn't it be a PAWN bug...?


Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Seif_
No, but it's better.
pawn Code:
public OnPlayerConnect(playerid)
{
    new file[64], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof pname);
    format(file, sizeof file, "/applies/%s.ini", pname);
    if(fexist) SendClientMessage(playerid, red, "You have already made your application!");
    else SendClientMessage(playerid,green,"Wanna apply for Administrator ? Type /aa for a IN-GAME Admin Apply!!");
  return 1;
}
Thanks, it worked!
"else"


Re: Help please. - rafay - 04.01.2009

Quote:
Originally Posted by Seif_
I updated my post. I forgot to fill fexist.
oh i did it myself.