if is player alredy registred he can do that again
#1

i will give anyhing you need .D
Reply
#2

-If you want to make it custom for players to check connection of players,just use a variable like;

pawn Код:
new isplayerconnected[MAX_PLAYERS];
Put it into your OnPlayerConnect(playerid) callback.
pawn Код:
isplayerconnected[playerid] = 1;
Commands,publics etc..

pawn Код:
if(isplayerconnected[playerid] == 0) return SendClientMessage(playerid,-1,"ERROR: You haven't connected to server, properly..");
Reply
#3

give me D
Reply
#4

You can use a Boolean - at the top of your script:
pawn Код:
new bool: PlayerRegistered[MAX_PLAYERS];
Once the player has registered in your gamemode add:
pawn Код:
PlayerRegistered[playerid] = true;
once the player has connected to the server -
pawn Код:
PlayerRegistered[playerid] = false;
for clearing it.

Save the data using your saving system and load it too.

Why a Boolean?: it uses 1byte, why would you need a 2 byte integer once you want two values 0 and 1 for example? --- if you want other values do not use Boolean!

I hope I helped any feedback is appreciated!
Reply
#5

Quote:
Originally Posted by KingHual
Посмотреть сообщение
give me D
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"reg",""COL_WHITE"bad pass.\n"COL_WHITE"type pass to reg.","reg","exit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Age",0);
INI_WriteInt(File,"Sex",2);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Location",0);
INI_Close(File);

ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,"Age?","\nType age using numbers.","ok","");
}
}
case DIALOG_AGE:
{
if(!response) return Kick(playerid);
if(response)
{
new age, message[64];

age = strval(inputtext);
if(age < 13 || age > 70)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,"Age?","Type age using numbers.","Ok","");
SendClientMessage(playerid, 0x33CCFFAA, "at least 13 years!");
}
else
{
PlayerInfo[playerid][pAge] = age;
SendClientMessage(playerid, 0x33CCFFAA, message);
ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST,"male or female","male\nfemale","Ok","");
}
}
}
case DIALOG_SEX:
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pSex] = 0;
PlayerInfo[playerid][pSkin] = 20;
printf("Skin has been set to 20");
ShowPlayerDialog(playerid, DIALOG_LOCATION, DIALOG_STYLE_LIST,"spawn","LS ","OK","");
}
if(listitem == 1)
{
PlayerInfo[playerid][pSex] = 1;
PlayerInfo[playerid][pSkin] = 12;
printf("Skin has been set to 12");
ShowPlayerDialog(playerid, DIALOG_LOCATION, DIALOG_STYLE_LIST,"SPAWN","LOS SANTOS","OK","");
}
}
}
case DIALOG_LOCATION:
{
if(!response) return Kick(playerid);
if(response)
{
new message[64];
if(listitem == 0)
{
PlayerInfo[playerid][pLocation] = 0;
format(message, sizeof(message), "MSG");
SendClientMessage(playerid, 0xFFFFFFFF, message);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1713.6101,-1912.2190,13.5669,85.9081, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
if(listitem == 1)
{
PlayerInfo[playerid][pLocation] = 1;
format(message, sizeof(message), "MSG");
SendClientMessage(playerid, 0xFFFFFFFF, message);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
if(listitem == 2)
{
PlayerInfo[playerid][pLocation] = 2;
format(message, sizeof(message), "MSG");
SendClientMessage(playerid, 0xFFFFFFFF, message);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else
{
Kick(playerid);
}
return 1;
}
}
}
return 1;
}
 if(clickedid == reglog7)
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"REG!","\nWELCOME TO SRW\n{FFFFFF}HI THERE\n{FFFFFF}Forum {FFFFFF}www.SS.com\nENJOY!","REG","QT");
        TextDrawHideForPlayer(playerid, reglog0);
        TextDrawHideForPlayer(playerid, reglog1);
        TextDrawHideForPlayer(playerid, reglog2);
        TextDrawHideForPlayer(playerid, reglog3);
        TextDrawHideForPlayer(playerid, reglog4);
        TextDrawHideForPlayer(playerid, reglog5);
        TextDrawHideForPlayer(playerid, reglog6);
        TextDrawHideForPlayer(playerid, reglog7);
        }
    if(clickedid== reglog6)
    {
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"LOGIN","\nAF\nForum www.CS.com\nPUT PASS TO LOGIN","LOG","EXIT");
    TextDrawHideForPlayer(playerid, reglog0);
    TextDrawHideForPlayer(playerid, reglog1);
    TextDrawHideForPlayer(playerid, reglog2);
    TextDrawHideForPlayer(playerid, reglog3);
    TextDrawHideForPlayer(playerid, reglog4);
    TextDrawHideForPlayer(playerid, reglog5);
    TextDrawHideForPlayer(playerid, reglog6);
    TextDrawHideForPlayer(playerid, reglog7);
    }
    return 1;
}
i think this is all you need
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)