Help please.
#1

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 ?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply
#7

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)
Reply
#8

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

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;
}
Reply
#10

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 ?
Reply
#11

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

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"
Reply
#13

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


Forum Jump:


Users browsing this thread: 1 Guest(s)