Script help, 1 error 5 warnings.
#1

Well hello, I am new to scripting and I am trying to make my own simple dm script. (To learn some and earn some exp.).
So here's the error message.

Код HTML:
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(342) : warning 202: number of arguments does not match definition
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(387) : warning 202: number of arguments does not match definition
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(395) : warning 217: loose indentation
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(403) : warning 202: number of arguments does not match definition
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(409) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(413) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And here's the whole script, if anyone could tell me how to fix, and tell me what causes it I'll be greatfull!

Код HTML:
public OnPlayerSpawn(playerid)
{
//---------------------[SPAWN/S]------------------------------//
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462,6.0277);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 5000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GivePlayerMoney(playerid, -250);
	SendClientMessage(playerid, COLOR_YELLOW, "You have died, and due to your death you have paid 250$ hospital bills.");
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 5) == 0)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hazard-Gaming/HZG - rules, and helpfull information.");
		SendClientMessage(playerid, COLOR_WHITE, "You're currently playing on HZG stunt server, V1.0 - Created by Kabron`.");
		SendClientMessage(playerid, COLOR_WHITE, "You can use /cmds and /teles for a list of available commands and teleports.");
		SendClientMessage(playerid, COLOR_WHITE, "For any questions you'll be able to use /faq, or /report and wait for an admin to respond.");
		SendClientMessage(playerid, COLOR_WHITE, "If you've any suggestions, or usefull information please post it at our forums - www.hz-gaming.com.");
		return 1;
	}
	
    if (strcmp("/cranedm", cmdtext, true, 5) == 0)
    {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to teleport to Crane-DM! Have fun, and watch your ass.");
		ResetPlayerWeapons(playerid);
		SetPlayerPos(playerid, 2737.6313,-2502.9897,13.4869,341.5870);
		GivePlayerWeapon(playerid, 23, 200);
		GivePlayerWeapon(playerid, 26, 100);
		GivePlayerWeapon(playerid, 31, 500);
		GivePlayerWeapon(playerid, 41, 50);
		return 1;
	 }
	 
	 if (strcmp("/teles", cmdtext, true, 5) == 0)
	 {
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the available teleports", "Deathmatches: /cranedm, \nStunt maps: /sfair, \nJumps:", "Thank-you!", "Close");
		return 1;
	 }
	 
	 if (strcmp("/sfair", cmdtext, true, 5) == 0)
	 {
       SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462,6.0277);
       SendClientMessage(playerid, COLOR_ORANGE, "You've decided to teleport to the San Fierro airport, enjoy your stunting!");
       return 1;
     }
     
     if (strcmp("/cmds", cmdtext, true, 5) == 0
	 {
	   ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the commands there are.", "For teleports - use /teles. \nFor any help you can use /help, or /faq. \nTo request an administrators help, or report anything use /report. \nTo purchase weapons use - /shop. \n To reach the vehicle menu use - /v.", "Thank-you!", "Close");
	   return 1;
     }
  return 0;
}
Thanks ahead.
Reply
#2

mark the lines on the errors please.

pawn Код:
public OnPlayerSpawn(playerid)
{
//---------------------[SPAWN/S]------------------------------//
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 5000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(playerid, -250);
    SendClientMessage(playerid, COLOR_YELLOW, "You have died, and due to your death you have paid 250$ hospital bills.");
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hazard-Gaming/HZG - rules, and helpfull information.");
        SendClientMessage(playerid, COLOR_WHITE, "You're currently playing on HZG stunt server, V1.0 - Created by Kabron`.");
        SendClientMessage(playerid, COLOR_WHITE, "You can use /cmds and /teles for a list of available commands and teleports.");
        SendClientMessage(playerid, COLOR_WHITE, "For any questions you'll be able to use /faq, or /report and wait for an admin to respond.");
        SendClientMessage(playerid, COLOR_WHITE, "If you've any suggestions, or usefull information please post it at our forums - www.hz-gaming.com.");
        return 1;
    }
   
    if (strcmp("/cranedm", cmdtext, true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to teleport to Crane-DM! Have fun, and watch your ass.");
        ResetPlayerWeapons(playerid);
        SetPlayerPos(playerid, 2737.6313,-2502.9897,13.4869);
        GivePlayerWeapon(playerid, 23, 200);
        GivePlayerWeapon(playerid, 26, 100);
        GivePlayerWeapon(playerid, 31, 500);
        GivePlayerWeapon(playerid, 41, 50);
        return 1;
     }
     
     if (strcmp("/teles", cmdtext, true, 5) == 0)
     {
        ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the available teleports", "Deathmatches: /cranedm, \nStunt maps: /sfair, \nJumps:", "Thank-you!", "Close");
        return 1;
     }
     
     if (strcmp("/sfair", cmdtext, true, 5) == 0)
     {
       SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
       SendClientMessage(playerid, COLOR_ORANGE, "You've decided to teleport to the San Fierro airport, enjoy your stunting!");
       return 1;
     }
     
     if (strcmp("/cmds", cmdtext, true, 5) == 0)
     {
       ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the commands there are.", "For teleports - use /teles. \nFor any help you can use /help, or /faq. \nTo request an administrators help, or report anything use /report. \nTo purchase weapons use - /shop. \n To reach the vehicle menu use - /v.", "Thank-you!", "Close");
     }
  return 0;
}
This should work however.
Reply
#3

Код:
public OnPlayerSpawn(playerid)
{
//---------------------[SPAWN/S]------------------------------//
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462,6.0277);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 5000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GivePlayerMoney(playerid, -250);
	SendClientMessage(playerid, COLOR_YELLOW, "You have died, and due to your death you have paid 250$ hospital bills.");
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 5) == 0)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hazard-Gaming/HZG - rules, and helpfull information.");
		SendClientMessage(playerid, COLOR_WHITE, "You're currently playing on HZG stunt server, V1.0 - Created by Kabron`.");
		SendClientMessage(playerid, COLOR_WHITE, "You can use /cmds and /teles for a list of available commands and teleports.");
		SendClientMessage(playerid, COLOR_WHITE, "For any questions you'll be able to use /faq, or /report and wait for an admin to respond.");
		SendClientMessage(playerid, COLOR_WHITE, "If you've any suggestions, or usefull information please post it at our forums - www.hz-gaming.com.");
		return 1;
	}
	
    if (strcmp("/cranedm", cmdtext, true, 5) == 0)
    {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to teleport to Crane-DM! Have fun, and watch your ass.");
		ResetPlayerWeapons(playerid);
		SetPlayerPos(playerid, 2737.6313,-2502.9897,13.4869);
		GivePlayerWeapon(playerid, 23, 200);
		GivePlayerWeapon(playerid, 26, 100);
		GivePlayerWeapon(playerid, 31, 500);
		GivePlayerWeapon(playerid, 41, 50);
		return 1;
	 }
	 
	 if (strcmp("/teles", cmdtext, true, 5) == 0)
	 {
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the available teleports", "Deathmatches: /cranedm, \nStunt maps: /sfair, \nJumps:", "Thank-you!", "Close");
		return 1;
	 }
	 
	 if (strcmp("/sfair", cmdtext, true, 5) == 0)
	 {
       SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
       SendClientMessage(playerid, COLOR_ORANGE, "You've decided to teleport to the San Fierro airport, enjoy your stunting!");
       return 1;
     }
     
     if (strcmp("/cmds", cmdtext, true, 5) == 0
	 {
	   ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the commands there are.", "For teleports - use /teles. \nFor any help you can use /help, or /faq. \nTo request an administrators help, or report anything use /report. \nTo purchase weapons use - /shop. \n To reach the vehicle menu use - /v.", "Thank-you!", "Close");
	   return 1;
     }
  return 0;
}
Try this. If it doesn't work I'm sorry, I hope you figure it out!
Reply
#4

Quote:
Originally Posted by Josh_Main
Посмотреть сообщение
Код:
public OnPlayerSpawn(playerid)
{
//---------------------[SPAWN/S]------------------------------//
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462,6.0277);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 5000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GivePlayerMoney(playerid, -250);
	SendClientMessage(playerid, COLOR_YELLOW, "You have died, and due to your death you have paid 250$ hospital bills.");
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 5) == 0)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hazard-Gaming/HZG - rules, and helpfull information.");
		SendClientMessage(playerid, COLOR_WHITE, "You're currently playing on HZG stunt server, V1.0 - Created by Kabron`.");
		SendClientMessage(playerid, COLOR_WHITE, "You can use /cmds and /teles for a list of available commands and teleports.");
		SendClientMessage(playerid, COLOR_WHITE, "For any questions you'll be able to use /faq, or /report and wait for an admin to respond.");
		SendClientMessage(playerid, COLOR_WHITE, "If you've any suggestions, or usefull information please post it at our forums - www.hz-gaming.com.");
		return 1;
	}
	
    if (strcmp("/cranedm", cmdtext, true, 5) == 0)
    {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to teleport to Crane-DM! Have fun, and watch your ass.");
		ResetPlayerWeapons(playerid);
		SetPlayerPos(playerid, 2737.6313,-2502.9897,13.4869);
		GivePlayerWeapon(playerid, 23, 200);
		GivePlayerWeapon(playerid, 26, 100);
		GivePlayerWeapon(playerid, 31, 500);
		GivePlayerWeapon(playerid, 41, 50);
		return 1;
	 }
	 
	 if (strcmp("/teles", cmdtext, true, 5) == 0)
	 {
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the available teleports", "Deathmatches: /cranedm, \nStunt maps: /sfair, \nJumps:", "Thank-you!", "Close");
		return 1;
	 }
	 
	 if (strcmp("/sfair", cmdtext, true, 5) == 0)
	 {
       SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
       SendClientMessage(playerid, COLOR_ORANGE, "You've decided to teleport to the San Fierro airport, enjoy your stunting!");
       return 1;
     }
     
     if (strcmp("/cmds", cmdtext, true, 5) == 0
	 {
	   ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the commands there are.", "For teleports - use /teles. \nFor any help you can use /help, or /faq. \nTo request an administrators help, or report anything use /report. \nTo purchase weapons use - /shop. \n To reach the vehicle menu use - /v.", "Thank-you!", "Close");
	   return 1;
     }
  return 0;
}
Try this
Won't Work.

U forgot these lines:
pawn Код:
if (strcmp("/cmds", cmdtext, true, 5) == 0
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462,6.0277);
Reply
#5

Код HTML:
public OnPlayerSpawn(playerid)
{
//---------------------[SPAWN/S]------------------------------//
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 5000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GivePlayerMoney(playerid, -250);
	SendClientMessage(playerid, COLOR_YELLOW, "You have died, and due to your death you have paid 250$ hospital bills.");
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 5) == 0)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hazard-Gaming/HZG - rules, and helpfull information.");
		SendClientMessage(playerid, COLOR_WHITE, "You're currently playing on HZG stunt server, V1.0 - Created by Kabron`.");
		SendClientMessage(playerid, COLOR_WHITE, "You can use /cmds and /teles for a list of available commands and teleports.");
		SendClientMessage(playerid, COLOR_WHITE, "For any questions you'll be able to use /faq, or /report and wait for an admin to respond.");
		SendClientMessage(playerid, COLOR_WHITE, "If you've any suggestions, or usefull information please post it at our forums - www.hz-gaming.com.");
		return 1;
	}
	
    if (strcmp("/cranedm", cmdtext, true, 5) == 0)
    {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to teleport to Crane-DM! Have fun, and watch your ass.");
		ResetPlayerWeapons(playerid);
		SetPlayerPos(playerid, 2737.6313,-2502.9897,13.4869);
		GivePlayerWeapon(playerid, 23, 200);
		GivePlayerWeapon(playerid, 26, 100);
		GivePlayerWeapon(playerid, 31, 500);
		GivePlayerWeapon(playerid, 41, 50);
		return 1;
	 }
	 
	 if (strcmp("/teles", cmdtext, true, 5) == 0)
	 {
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the available teleports", "Deathmatches: /cranedm, \nStunt maps: /sfair, \nJumps:", "Thank-you!", "Close");
		return 1;
	 }
	 
	 if (strcmp("/sfair", cmdtext, true, 5) == 0)
	 {
       SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
       SendClientMessage(playerid, COLOR_ORANGE, "You've decided to teleport to the San Fierro airport, enjoy your stunting!");
       return 1;
     }
     
     if (strcmp("/cmds", cmdtext, true, 5) == 0)
	 {
	   ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the commands there are.", "For teleports - use /teles. \nFor any help you can use /help, or /faq. \nTo request an administrators help, or report anything use /report. \nTo purchase weapons use - /shop. \n To reach the vehicle menu use - /v.", "Thank-you!", "Close");
     }
  return 0;
}

It works however there're two warning, lines 395 and 412. Those are the errors;

Line 395:
if (strcmp("/teles", cmdtext, true, 5) == 0)

And line 412:
return 0;

Here's the warning message:

Код HTML:
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(395) : warning 217: loose indentation
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(412) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#6

Quote:
Originally Posted by CLT
Посмотреть сообщение
Код HTML:
public OnPlayerSpawn(playerid)
{
//---------------------[SPAWN/S]------------------------------//
SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 5000);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GivePlayerMoney(playerid, -250);
	SendClientMessage(playerid, COLOR_YELLOW, "You have died, and due to your death you have paid 250$ hospital bills.");
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 5) == 0)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hazard-Gaming/HZG - rules, and helpfull information.");
		SendClientMessage(playerid, COLOR_WHITE, "You're currently playing on HZG stunt server, V1.0 - Created by Kabron`.");
		SendClientMessage(playerid, COLOR_WHITE, "You can use /cmds and /teles for a list of available commands and teleports.");
		SendClientMessage(playerid, COLOR_WHITE, "For any questions you'll be able to use /faq, or /report and wait for an admin to respond.");
		SendClientMessage(playerid, COLOR_WHITE, "If you've any suggestions, or usefull information please post it at our forums - www.hz-gaming.com.");
		return 1;
	}
	
    if (strcmp("/cranedm", cmdtext, true, 5) == 0)
    {
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to teleport to Crane-DM! Have fun, and watch your ass.");
		ResetPlayerWeapons(playerid);
		SetPlayerPos(playerid, 2737.6313,-2502.9897,13.4869);
		GivePlayerWeapon(playerid, 23, 200);
		GivePlayerWeapon(playerid, 26, 100);
		GivePlayerWeapon(playerid, 31, 500);
		GivePlayerWeapon(playerid, 41, 50);
		return 1;
	 }
	 
	 if (strcmp("/teles", cmdtext, true, 5) == 0)
	 {
		ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the available teleports", "Deathmatches: /cranedm, \nStunt maps: /sfair, \nJumps:", "Thank-you!", "Close");
		return 1;
	 }
	 
	 if (strcmp("/sfair", cmdtext, true, 5) == 0)
	 {
       SetPlayerPos(playerid, -1387.0272,-200.5146,14.1462);
       SendClientMessage(playerid, COLOR_ORANGE, "You've decided to teleport to the San Fierro airport, enjoy your stunting!");
       return 1;
     }
     
     if (strcmp("/cmds", cmdtext, true, 5) == 0)
	 {
	   ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "All the commands there are.", "For teleports - use /teles. \nFor any help you can use /help, or /faq. \nTo request an s help, or report anything use /report. \nTo purchase weapons use - /shop. \n To reach the vehicle menu use - /v.", "Thank-you!", "Close");
     }
  return 0;
}

It works however there're two warning, lines 395 and 412. Those are the errors;

Line 395:
if (strcmp("/teles", cmdtext, true, 5) == 0)

And line 412:
return 0;

Here's the warning message:

Код HTML:
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(395) : warning 217: loose indentation
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(412) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings
loose indentations don't really matter, but if you would like to fix it you need to make sure you have spaced out the lines with the warnings correctly. Read this, it may help you fix it. Good luck!
Reply
#7

Quote:
Originally Posted by Josh_Main
Посмотреть сообщение
loose indentations don't really matter, but if you would like to fix it you need to make sure you have spaced out the lines with the warnings correctly. Read this, it may help you fix it. Good luck!
Thank you, it really helped.
Reply
#8

Anytime Good luck
Reply
#9

You're welcome.
Reply
#10

Quote:
Originally Posted by Josh_Main
Посмотреть сообщение
Anytime Good luck
Thanks!

Quote:
Originally Posted by introzen
Посмотреть сообщение
You're welcome.
Once again, thanks for fixing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)