help me fix error
#1

Код:
#include <a_samp>
#include <core>
#include <float>
#include <dini>

#define DIALOG_REGISTER1 0
#define DIALOG_REGISTER2 1
#define DIALOG_REGISTER3 2
#define DIALOG_REGISTER4 3
#define DIALOG_LOGIN1 4
#define DIALOG_NOPW1 5
#define DIALOG_NOPW2 6
#define DIALOG_WRONGPW 7

enum Info
{
   sex, //0= male 1=female
   age, // age :3
   logged, // If is player connected
}
new pInfo[MAX_PLAYERS][Info];

#pragma tabsize 0

main()
{
	print("\n----------------------------------");
	print("  Bare Script\n");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
	new pname[MAX_PLAYER_NAME], path[200];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(path, sizeof(path), "/spieler/%s.ini", pname);
	if(!dini_Exists(path))
	{
	// f the player is not registered
	ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_INPUT, "Register", "Your Password:", "OK", "Cancel");
	}
	else
	{
    //If the player is registered
    ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_INPUT, "Login", "Your Password", "OK", "Cancel");
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new idx;
	new cmd[256];
	
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/yadayada", true) == 0) {
    	return 1;
	}

	return 0;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerInterior(playerid,0);
	TogglePlayerClock(playerid,0);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
   	return 1;
}

SetupPlayerForClassSelection(playerid)
{
 	SetPlayerInterior(playerid,14);
	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerRequestClass(playerid, classid)
{
	SetupPlayerForClassSelection(playerid);
	return 1;
}

public OnGameModeInit()
{
	SetGameModeText("Bare Script");
	ShowPlayerMarkers(1);
	ShowNameTags(1);
	AllowAdminTeleport(1);

	AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);

	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new pname[MAX_PLAYER_NAME], path[200];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(path, sizeof(path), "/spieler/%s.ini", pname);

	switch(dialogid)
	{
	   case DIALOG_REGISTER1:
	   {
	  	if(!response)
	  	{
	      	Kick(playerid);
	  	}
	  	else
	  	{
	     	new pwlength = strlen(inputtext);
	     	if(pwlength > 0)
	     	{
	        	dini_Create(path);
	        	dini_Set(path, "password", inputtext);
	        	ShowPlayerDialog(playerid, DIALOG_REGISTER2, DIALOG_STYLE_LIST, "male\r\female", "OK", "Cancel");
	     	}
	     	else
	     	{
	        	ShowPlayerDialog(playerid, DIALOG_NOPW1, DIALOG_STYLE_MSGBOX, "Register", "You have to enter a password!", "OK", "Cancel");
	     	}
	  	}
	   }
	   case DIALOG_REGISTER2:
	   {
	  	if(!response)
	  	{
	     	dini_Remove(path);
	     	Kick(playerid);
	  	}
	  	else
	  	{
	     	dini_IntSet(path, "sex", listitem);
	     	ShowPlayerDialog(playerid, DIALOG_REGISTER3, DIALOG_STYLE_INPUT, "Register", "Your Age?", "OK", "Cancel");
	  	}
	   }
	   case DIALOG_REGISTER3:
	   {
	  	if(!response)
	  	{
	     	dini_Remove(path);
	      	Kick(playerid);
	  	}
	  	else
		  {
	     	dini_Set(path, "age", inputtext);
	     	ShowPlayerDialog(playerid, DIALOG_REGISTER4, DIALOG_STYLE_MSGBOX, "Register", "Your Register is complete!", "OK", "OK");
	      }
	   }
	   case DIALOG_REGISTER4:
	   {
	  	pInfo[playerid][sex] = dini_Int(path, "sex");
	  	pInfo[playerid][age] = dini_Int(path, "age");
	  	pInfo[playerid][logged] = 1;
	   }
	   case DIALOG_LOGIN1:
	   {
	  	if(!response)
	  	{
	     	Kick(playerid);
	  	}
	  	else
	  	{
	     	new pwlength = strlen(inputtext);
	     	if(pwlength > 0)
	     	{
	        	new pw[200];
	        	format(pw, sizeof(pw), "%s", dini_Get(path, "password");
	        	if(strcmp(inputtext, pw) == 0)
	        	{
	           	pInfo[playerid][sex] = dini_Int(path, "sex");
	           	pInfo[playerid][age] = dini_Int(path, "age");
	           	pInfo[playerid][logged] = 1;
	        	}
	        	else
	        	{
	           	ShowPlayerDialog(playerid, DIALOG_WRONGPW, DIALOG_STYLE_MSGBOX, "Login", "Wrong Password!", "OK", "Cancel");
	        	}
	     	}
	     	else
	     	{
	        	ShowPlayerDialog(playerid, DIALOG_NOPW2, DIALOG_STYLE_MSGBOX,  "Login", "SYou have to enter a password!", "OK", "Cancel");
	     	}
	  	}
	   }
	  case DIALOG_NOPW1:
	  {
	 	if(!response)
	 	{
	    	Kick(playerid);
	 	}
	 	else
	 	{
	    	ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_INPUT,  "Register", "Your Password", "OK",  "Cancel");
	 	}
	  }
	  case DIALOG_NOPW2:
	  {
	 	if(!response)
	 	{
	    	Kick(playerid);
	 	}
	 	else
	 	{
	    	 ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_INPUT,   "Login", "Your Password:", "OK",   "Abbrechen");
	 	}
	  }
	  case DIALOG_WRONGPW:
	  {
	 	if(!response)
	 	{
	    	Kick(playerid);
	 	}
	 	else
	 	{
	    	 ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_INPUT,    "Login", "Your Password:", "OK",   "Cancel");
	 	}
	  }
	}
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
public OnPlayerDisconnect(playerid, reason)
{
	new pname[MAX_PLAYER_NAME], path[200];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(path, sizeof(path), "/spieler/%s.ini", pname);

	dini_IntSet(path, "sex", pInfo[playerid][sex]);
	dini_IntSet(path, "age", pInfo[playerid][age]);

	pInfo[playerid][logged] = 0;
    return 1;
}
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
Код:
D:\HOMEWORK\GTA\Menu\GAME_MODE_SAMP\YES\samp03z_svr_R1_win32\gamemodes\bare.pwn(123) : warning 202: number of arguments does not match definition
D:\HOMEWORK\GTA\Menu\GAME_MODE_SAMP\YES\samp03z_svr_R1_win32\gamemodes\bare.pwn(175) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

the error at line 123:
Quote:
Originally Posted by beedon02
Посмотреть сообщение
Код:
ShowPlayerDialog(playerid, DIALOG_REGISTER2, DIALOG_STYLE_LIST, "male\r\female", "OK", "Cancel");
the "caption" parameter is missing
prototype:
Код:
ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[])
pawn Код:
ShowPlayerDialog(playerid, DIALOG_REGISTER2, DIALOG_STYLE_LIST, "title", "male\r\female", "OK", "Cancel");
the error at line 175:
Quote:
Originally Posted by beedon02
Посмотреть сообщение
Код:
format(pw, sizeof(pw), "%s", dini_Get(path, "password");
you're missing a brace after dini_Get for closing the format function
pawn Код:
format(pw, sizeof(pw), "%s", dini_Get(path, "password"));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)