SA-MP Forums Archive
script eror - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: script eror (/showthread.php?tid=161340)



script eror - admine - 19.07.2010

script:
Код:
public OnPlayerCommandText(playerid, cmdtext[]){
  {
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
   	new tmp[256];
    new playername[MAX_PLAYER_NAME];
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
	    TogglePlayerControllable(playerid,0);
		ShowMenuForPlayer(HelpMenu,playerid);
		return 1;
	}
	if (strcmp("/buy", cmdtext, true, 10) == 0)
	{
	    TogglePlayerControllable(playerid,0);
		ShowMenuForPlayer(BuyMenu,playerid);
		return 1;
	}
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
	    SetPlayerHealth(playerid,0.0);
		return 1;
	}
	if (strcmp("/eng", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,blue,"                  Server Info: Rules            ");
		SendClientMessage(playerid,blue,"________________________________________");

		SendClientMessage(playerid,white," Don't HACK!");
		SendClientMessage(playerid,white," Don't SpawnKill!");
		SendClientMessage(playerid,white," Don't Insult!");
		SendClientMessage(playerid,white," Respect the Players and the admins!");
		return 1;
	}
	if (strcmp("/ita", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,blue,"                  Server Info: Regole            ");
		SendClientMessage(playerid,blue,"________________________________________");

		SendClientMessage(playerid,white," Non HACK!");
		SendClientMessage(playerid,white," Non SpawnKill!");
		SendClientMessage(playerid,white," Non insulto!");
		SendClientMessage(playerid,white," Rispettare i giocatori e la amministratori!");
		return 1;
	}
	if (strcmp("/spa", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,blue,"       Servidor de Informaciуn: Reglamento.            ");
		SendClientMessage(playerid,blue,"________________________________________");

		SendClientMessage(playerid,white," No Hack!");
		SendClientMessage(playerid,white," No SpawnKill!");
		SendClientMessage(playerid,white," No Insulto!");
		SendClientMessage(playerid,white," El respeto de los jugadores y los administradores!");
		return 1;
	}
	if (strcmp("/nl", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,blue,"       Server info: Regels            ");
		SendClientMessage(playerid,blue,"________________________________________");

		SendClientMessage(playerid,white," geen gehack!");
		SendClientMessage(playerid,white," geen spawkills");
		SendClientMessage(playerid,white," geen insult");
		SendClientMessage(playerid,white," Respecteer de players en de staff, veel speel plezier");
		return 1;
	}
	if (strcmp("/ger", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,blue,"               Server Info: Regeln            ");
		SendClientMessage(playerid,blue,"________________________________________");

		SendClientMessage(playerid,white," Keine Hack!");
		SendClientMessage(playerid,white," Nicht Spawnkill!");
		SendClientMessage(playerid,white," Keine Beleidigung!");
		SendClientMessage(playerid,white," Respektieren Sie die Spieler und die Admins!");
		return 1;
	}
	if (strcmp(cmd, "/login", true) ==0 )
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new tmppass[64];
			if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, grey, "	You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, grey, "	USAGE: /login [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			String(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
	}
	if (strcmp(cmd, "/register", true)==0)
	{
		new string[265];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, grey, "USAGE: /register [password]");
			return 1;
		}
		if (gPlayerAccount[playerid] == 1)
		{
			SendClientMessage(playerid, grey, "   That nickname is already registered");
			return 1;
		}

		strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255);
		String(PlayerInfo[playerid][pPassword]);
		GetPlayerName(playerid, playername, sizeof(playername));
		format(string, sizeof(string), "%s.cer", playername);
		new File: file = fopen(string, io_read);
		if (file)
		{
			SendClientMessage(playerid, grey, "   That name is already registered");
			fclose(file);
			return 1;
		}
		new File:hFile;
		hFile = fopen(string, io_append);
		new var[32];//
        format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
        format(var, 32, "Kills:%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
        format(var, 32, "Deaths:%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
        PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
        format(var, 32, "Cash:%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
		fclose(hFile);
		SendClientMessage(playerid, white, "Succesfully Registered!");
		SendClientMessage(playerid, white, "Next time when you come , use /login [ password ].");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	return 0;
}
eror:
Код:
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1085) : error 017: undefined symbol "strtok"
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1085) : error 033: array must be indexed (variable "cmd")
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1091) : error 017: undefined symbol "HelpMenu"
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1097) : error 017: undefined symbol "BuyMenu"
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1165) : error 017: undefined symbol "gPlayerLogged"
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1165) : warning 215: expression has no effect
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1165) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1165) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Londen\BUREAU~1\SA-MPS~1\GAMEMO~1\ROLEPL~2.PWN(1165) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.



Re: script eror - Kar - 19.07.2010

gj copy and pasting from a diff script change
helpmenu = take out the help menu from the script and the same for buymenu

error 1091 change cmd w/e to cmd[128];

strtok is in one of your includes that same with sa-mp. in pawno/includes folder

put this at the top of your script

pawn Код:
new gPlayerLogged[MAX_PLAYERS];



Re: script eror - admine - 19.07.2010

no it was'nt the return 0; and the new scripting that was not of the cmd because the regestration command was gecrasht


Re: script eror - Kar - 19.07.2010

i never told you it was the return 0? YOU have to have return 0 in onplayercommandtext and what language was that? Do you have Eye Sight Problems? Cause You Did Not Read What I Said Correctly

since i see dutch in your please visit this site http://translate.******.com/

and this http://forum.sa-mp.com/forumdisplay.php?f=31 = dutch forums before you speak here again.<.<


Re: script eror - TouR - 19.07.2010

Bro stop copy/paste :\ this way you will never code your own scripts


Re: script eror - admine - 19.07.2010

but I did not I cut and pasted it from my old script removed dm

I swear, I cut and paste a lot but it must be because there are things I do not know! but this script I did not cut and pasted, I just cut and paste job commands, if I can find one fact!


Re: script eror - Kar - 19.07.2010

if you didnt copy and paste from your old script you would obviously noticed that you created a menu and gPlayerlogged SO LOOK FOR THEM IN YOUR OLD SCRIPT


Re: script eror - TouR - 19.07.2010

Okay kar Relax this guy needs help thats why he posted.. LEt's help him!

First of all you missing the menus... search at the old script where the menus are located This willl help


Re: script eror - admine - 19.07.2010

no menu in my old script was broken so I thought I put it in my new script, I just had not been thinking that there's a registration system in it, so I removed that and he does it!

but in doing so I do not know how I can create a job command someone to help me here, because there are pretty much what to make of the fact there are 26


Re: script eror - TouR - 19.07.2010

Do you use Godfather edit? I mean the variable is [pJob] ?