SA-MP Forums Archive
An error. Making my own gamemode - 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)
+--- Thread: An error. Making my own gamemode (/showthread.php?tid=618378)



An error. Making my own gamemode - StrikerZ - 05.10.2016

Under Onplayerconnect
Код:
	if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");//720
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
	}
Код:
pwn(720) : error 001: expected token: "-string end-", but found "-identifier-"
pwn(720) : error 017: undefined symbol "COL_WHITE"
pwn(720) : warning 215: expression has no effect
pwn(720) : error 001: expected token: "-string end-", but found "-identifier-"
pwn(720) : fatal error 107: too many error messages on one line

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


4 Errors.
Any idea?


Re: An error. Making my own gamemode - X337 - 05.10.2016

Seems COL_WHITE isn't an embed color
Код:
	if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FFFFFF}Login","{FFFFFF}Type your password below to login.","Login","Quit");//720
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit");
	}



Re: An error. Making my own gamemode - DwayneMichael - 05.10.2016

Have you defined COL_WHITE? Example #define COL_WHITE "{FFFFFF}"


Re: An error. Making my own gamemode - StrikerZ - 05.10.2016

Yes i did defined it


Re: An error. Making my own gamemode - StrikerZ - 05.10.2016

@X337 tried your solution and it worked. But now i have another error with gTeam which is only in 1 command the other cmds which use gTeam don't have those errors.
Код:
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : error 017: undefined symbol "gTeam"
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : warning 215: expression has no effect
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : error 001: expected token: ";", but found "]"
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : error 029: invalid expression, assumed zero
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : fatal error 107: too many error messages on one line

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


4 Errors.
Код:
CMD:tazer(playerid, params[])
{
	if(gTeam[playerid] == LSPD) // For cops //981
    {
    	if(IsPlayerInAnyVehicle(playerid)) // Checks if the player is in a vehicle.
        {
        	SendClientMessage(playerid, 0xFF0000FF, "You can't use this command while in a car!");
         	return 1;
        }
        if(pTazer[playerid] == 0) // If the player has no tazer withdrawn.
        {
            GivePlayerWeapon(playerid, 23, 9999); // Gives a SD.
            pTazer[playerid] = 1; // Sets the var to true.
            return 1;
        }
        else if(pTazer[playerid == 1) // If the player has the tazer withdrawn to holster it.
        {
            GivePlayerWeapon(playerid, 24, 250); // Gives a deagle.
            pTazer[playerid] = 0; // Sets the var to false.
            return 1;
        }
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
	}
 	return 1;
}



Re: An error. Making my own gamemode - Tass007 - 05.10.2016

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
@X337 tried your solution and it worked. But now i have another error with gTeam which is only in 1 command the other cmds which use gTeam don't have those errors.
Код:
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : error 017: undefined symbol "gTeam"
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : warning 215: expression has no effect
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : error 001: expected token: ";", but found "]"
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : error 029: invalid expression, assumed zero
E:\backup\SFCRRPG\gamemodes\Sandhu.pwn(981) : fatal error 107: too many error messages on one line

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


4 Errors.
Код:
CMD:tazer(playerid, params[])
{
	if(gTeam[playerid] == LSPD) // For cops //981
    {
    	if(IsPlayerInAnyVehicle(playerid)) // Checks if the player is in a vehicle.
        {
        	SendClientMessage(playerid, 0xFF0000FF, "You can't use this command while in a car!");
         	return 1;
        }
        if(pTazer[playerid] == 0) // If the player has no tazer withdrawn.
        {
            GivePlayerWeapon(playerid, 23, 9999); // Gives a SD.
            pTazer[playerid] = 1; // Sets the var to true.
            return 1;
        }
        else if(pTazer[playerid == 1) // If the player has the tazer withdrawn to holster it.
        {
            GivePlayerWeapon(playerid, 24, 250); // Gives a deagle.
            pTazer[playerid] = 0; // Sets the var to false.
            return 1;
        }
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
	}
 	return 1;
}
You forgot to add a closing bracket.

Код:
  else if(pTazer[playerid] == 1) // If the player has the tazer withdrawn to holster it.



Re: An error. Making my own gamemode - StrikerZ - 05.10.2016

How can i disable the class selection?


Re: An error. Making my own gamemode - Tass007 - 05.10.2016

You don't want a player to go to class selection?

Код:
public OnPlayerRequestClass(playerid, classid)
{
        SetSpawnInfo();
	SpawnPlayer();
	return 1;
}
https://sampwiki.blast.hk/wiki/SetSpawnInfo
https://sampwiki.blast.hk/wiki/SpawnPlayer


Re: An error. Making my own gamemode - StrikerZ - 05.10.2016

Yes i'm making like this. After register i will make him show 2 textdraws stating Cops And Robbers. He will select either one of em and his team will be selected to that. That's why i asked. And please tell me some steps on how the team selection can be done


Re: An error. Making my own gamemode - Tass007 - 05.10.2016

You could do it so that if player text draw is clicked on (Assuming that you use 1 text draw for robbers, and another one for cops) that whatever textdraw is clicked on gets assigned a variable for example pRobbers[playerid] and pCops[playerid] assign the variable to 1 for whatever textdraw is clicked on. Then whenever you want to check if player is a cop or robber you check it using the variables. I hope this answers your question.


Depending on how you have defined your textdraw is what sort of OnPlayerClick you'll need to use. Don't name your textdraws these. This is just an example.
new Text: TextDraw; - https://sampwiki.blast.hk/wiki/OnPlayerClickTextDraw
new PlayerText: TextDraw[MAX_PLAYERS]; - https://sampwiki.blast.hk/wiki/OnPlayerClickPlayerTextDraw