[HELP] MAY U KNOW?
#1

Hey, I got an error. If I join my own server, it asks me which Age. After answering the Age it gets to the next question, Whats your Sex. If I enter male / female there, there comes then: thanks for filling the answer. But well, normally it should be done but I dont get unfreezed. I cant move anymore after answering the questions :<
Error must be maybe in the 3rd code, but cant find it :<

PHP код:
enum PInfo
{
    
pAge,
    
pSex
}
new 
PlayerInfo[MAX_PLAYERS][PInfo]; //How many there should be 
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
RegistrationStep[playerid] == 0)
    {
        
SendClientMessage(playerid,LIGHTBLUE,"What's your Age?");
        
SendClientMessage(playerid,WHITE,"Hint: Enter your 2 digit age");
        
TogglePlayerControllable(playerid,0); //Freezing the player
        
RegistrationStep[playerid] = 1//Sets our registrationstep to 1
        
return 1;
    }
    return 
1;

By OnPlayerText:
PHP код:
if(RegistrationStep[playerid] == 1)
    {
        if(!
strlen(text)) //Checks to make sure there is atleast 1 character input
        
{
            
SendClientMessage(playerid,LIGHTBLUE,"What's your Age?");
            
SendClientMessage(playerid,WHITE,"Hint: Enter your 2 digit age");
            return 
0//Ends the commands and doesnt display in text
        
}
        if(
strlen(text)< 2||strlen(text) > 2)//Checks that the input is only 2 characters long
        
{
            
SendClientMessage(playerid,0xD70000FF,"Only a 2 digit number will work!");
            return 
0;
        }
        new 
string[128]; //Creates a new string 128 characters long
        
format(string,sizeof(string),"Ok so you are %d years old",strval(text)); //Formats the string
        
SendClientMessage(playerid,LIGHTBLUE,string); //Sends new message with the string
        
PlayerInfo[playerid][pAge] = strval(text);
        
SendClientMessage(playerid,LIGHTBLUE,"What is your Sex?");
        
SendClientMessage(playerid,WHITE,"Hint: Enter male or female");
        
RegistrationStep[playerid] = 2;
        return 
0;
    }
    if(
RegistrationStep[playerid] == 2)
    {
        new 
tmp[4];
        if(!
strlen(text)) //Check to make sure there is at least 1 character input
        
{
            
SendClientMessage(playerid,LIGHTBLUE,"What is your Sex?");
            
SendClientMessage(playerid,WHITE,"Hint: Enter male or female");
            return 
0;
        }
        if(!
strcmp("male"tmptrue4))
        {
//Checks to see if the input matches "male" and if it does continues
            
PlayerInfo[playerid][pSex] = 1;
            
SendClientMessage(playerid,LIGHTBLUE,"Ok, so you are a Male.");
            
SendClientMessage(playerid,WHITE,"Thank you for filling in the information");
            
RegistrationStep[playerid] = 3;
            
TogglePlayerControllable(playerid,0);//Unfreezes the player and play resumes
            
return 0;
        }
        else if(!
strcmp("female"tmptrue6))
        {
//Checks to see if the input matches "female" and if it does continues
            
PlayerInfo[playerid][pSex] = 2;
            
SendClientMessage(playerid,LIGHTBLUE,"Ok, so you are a Female.");
            
SendClientMessage(playerid,WHITE,"Thank you for filling in the information");
            
RegistrationStep[playerid] = 3;
            
TogglePlayerControllable(playerid,0);//Unfreezes the player and play resumes
            
return 0;
        }
        else
        { 
SendClientMessage(playerid,WHITE,"Please answer your Gender!"); return 0; }
    } 
Reply
#2

You're actually freezing the player at the end of the "registration step".

pawn Код:
TogglePlayerControllable(playerid,0);//Unfreezes the player and play resumes
That should be

pawn Код:
TogglePlayerControllable(playerid,1);//Unfreezes the player and play resumes
Reply
#3

so I should change the first one to 0 that he gets freezed and the last one to 1 for unfreeze? And hey, which step do you mean now. The last Unfreezing? By male & Female?
Reply
#4

OnPlayerText:

pawn Код:
if(RegistrationStep[playerid] == 1)
    {
        if(!strlen(text)) //Checks to make sure there is atleast 1 character input
        {
            SendClientMessage(playerid,LIGHTBLUE,"What's your Age?");
            SendClientMessage(playerid,WHITE,"Hint: Enter your 2 digit age");
            return 0; //Ends the commands and doesnt display in text
        }
        if(strlen(text)< 2||strlen(text) > 2)//Checks that the input is only 2 characters long
        {
            SendClientMessage(playerid,0xD70000FF,"Only a 2 digit number will work!");
            return 0;
        }
        new string[128]; //Creates a new string 128 characters long
        format(string,sizeof(string),"Ok so you are %d years old",strval(text)); //Formats the string
        SendClientMessage(playerid,LIGHTBLUE,string); //Sends new message with the string
        PlayerInfo[playerid][pAge] = strval(text);
        SendClientMessage(playerid,LIGHTBLUE,"What is your Sex?");
        SendClientMessage(playerid,WHITE,"Hint: Enter male or female");
        RegistrationStep[playerid] = 2;
        return 0;

    }
    if(RegistrationStep[playerid] == 2)
    {
        new tmp[4];
        if(!strlen(text)) //Check to make sure there is at least 1 character input
        {
            SendClientMessage(playerid,LIGHTBLUE,"What is your Sex?");
            SendClientMessage(playerid,WHITE,"Hint: Enter male or female");
            return 0;
        }
        if(!strcmp("male", tmp, true, 4))
        {//Checks to see if the input matches "male" and if it does continues
            PlayerInfo[playerid][pSex] = 1;
            SendClientMessage(playerid,LIGHTBLUE,"Ok, so you are a Male.");
            SendClientMessage(playerid,WHITE,"Thank you for filling in the information");
            RegistrationStep[playerid] = 3;
            TogglePlayerControllable(playerid,1);//Unfreezes the player and play resumes
            return 0;
        }
        else if(!strcmp("female", tmp, true, 6))
        {//Checks to see if the input matches "female" and if it does continues
            PlayerInfo[playerid][pSex] = 2;
            SendClientMessage(playerid,LIGHTBLUE,"Ok, so you are a Female.");
            SendClientMessage(playerid,WHITE,"Thank you for filling in the information");
            RegistrationStep[playerid] = 3;
            TogglePlayerControllable(playerid,1);//Unfreezes the player and play resumes
            return 0;
        }
        else
        { SendClientMessage(playerid,WHITE,"Please answer your Gender!"); return 0; }
    }
Reply
#5

TogglePlayerControllable(playerid,1);

That will make the player controllable, like the function itself suggests.

Making it 0 will freeze the player, I'm sure you can figure out where you need to make the edits yourself.
Reply
#6

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
You're actually freezing the player at the end of the "registration step".

pawn Код:
TogglePlayerControllable(playerid,0);//Unfreezes the player and play resumes
That should be

pawn Код:
TogglePlayerControllable(playerid,1);//Unfreezes the player and play resumes
ah ok, thanks. ur awesome
Reply
#7

TogglePlayerControllable(playerid,1) = You can move and cnotrol the char
TogglePlayerControllale(playerid,0) = freezes the player


EDIT: Sorry for answerring something that was answerred, I think he wrote at the same time as me :P so I didn't know he posted
Reply
#8

And how do I save it on dini, also that it shows up by doing /stats? Could anyone do this?
Reply
#9

Search FTW.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)