SA-MP Forums Archive
[NEEDHELP] Problem with a command - 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: [NEEDHELP] Problem with a command (/showthread.php?tid=256509)



[NEEDHELP] Problem with a command - ImprezBart - 21.05.2011

Код:
if(strcmp(cmd,"/whereis",true)==0)
    {
        if(IsPlayerConnected(playerid))
	    {
		    if(IsPlayerInRangeOfPoint(playerid, 3.0, 1757.1124,-1943.9635,13.5684)) // INFO
		    new x_nr[32];
			x_nr = strtok(cmdtext, idx);
			if(!strlen(x_nr))
			{
			    SendClientMessage(playerid,COLOR_GRAD4,"Welcome to {33CCFF}Logical Roleplay's {D8D8D8}Map!");
			    SendClientMessage(playerid,COLOR_GRAD4,"[PLACES:] mp1");
			    return 1;
			}
			else
		    {
		         SendClientMessage(playerid, COLOR_GRAD2, "You are not at the Info Machine near Unity.");
		         return 1;
			}
            if(strcmp(x_nr,"mp1",true) == 0)
            {
                SendClientMessage(playerid,COLOR_GRAD4,"{FF0000}Material Pickup 1 {D8D8D8}has been marked on your map");
                SetPlayerCheckpoint(playerid, 2183.4563,-1502.8416,23.9568, 3.0); //MP1
                return 1;
			}
        }
        return 1;
    }
C
Код:
:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(10116) : warning 204: symbol is assigned a value that is never used: "string2"
C:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(35193) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(35193) : error 017: undefined symbol "x_nr"
C:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(35193) : warning 215: expression has no effect
C:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(35193) : error 001: expected token: ";", but found "]"
C:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(35193) : fatal error 107: too many error messages on one line

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


4 Errors.
I need some help, i am new to scripting.

- Thanks


Re: [NEEDHELP] Problem with a command - DeathOnaStick - 21.05.2011

Please mark me line 35193.


Re: [NEEDHELP] Problem with a command - ImprezBart - 21.05.2011

Here you go.
Quote:

new x_nr[32];




Re: [NEEDHELP] Problem with a command - DeathOnaStick - 21.05.2011

Quote:
Originally Posted by ImprezBart
Посмотреть сообщение
Here you go.
It seems like you forgot a '{' and a '}'.
pawn Код:
if(strcmp(cmd,"/whereis",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 3.0, 1757.1124,-1943.9635,13.5684)){ // INFO
            new x_nr[32];
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid,COLOR_GRAD4,"Welcome to {33CCFF}Logical Roleplay's {D8D8D8}Map!");
                SendClientMessage(playerid,COLOR_GRAD4,"[PLACES:] mp1");
                return 1;
            }
            else
            {
                 SendClientMessage(playerid, COLOR_GRAD2, "You are not at the Info Machine near Unity.");
                 return 1;
            }
            if(strcmp(x_nr,"mp1",true) == 0)
            {
                SendClientMessage(playerid,COLOR_GRAD4,"{FF0000}Material Pickup 1 {D8D8D8}has been marked on your map");
                SetPlayerCheckpoint(playerid, 2183.4563,-1502.8416,23.9568, 3.0); //MP1
                return 1;
            }
        }}
        return 1;
    }
Try this.


Re: [NEEDHELP] Problem with a command - ImprezBart - 21.05.2011

Thanks it worked but i still have a problem,
Quote:

C:\Users\Akkerman\Documents\Mijn ontvangen bestanden\Logical Roleplay [PRP]\Real World Roleplay\Public Roleplay by George Nakash\gamemodes\LG-RP.pwn(35206) : warning 225: unreachable code

That's this line:
Quote:

if(strcmp(x_nr,"mp1",true) == 0)




Re: [NEEDHELP] Problem with a command - DeathOnaStick - 21.05.2011

Quote:
Originally Posted by ImprezBart
Посмотреть сообщение
Thanks it worked but i still have a problem,


That's this line:
Okay try this one:
pawn Код:
if(strcmp(cmd,"/whereis",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 3.0, 1757.1124,-1943.9635,13.5684)){ // INFO
            new x_nr[32];
            x_nr = strtok(cmdtext, idx);
            if(strcmp(x_nr,"mp1",true) == 0)
            {
                SendClientMessage(playerid,COLOR_GRAD4,"{FF0000}Material Pickup 1 {D8D8D8}has been marked on your map");
                SetPlayerCheckpoint(playerid, 2183.4563,-1502.8416,23.9568, 3.0); //MP1
            }
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid,COLOR_GRAD4,"Welcome to {33CCFF}Logical Roleplay's {D8D8D8}Map!");
                SendClientMessage(playerid,COLOR_GRAD4,"[PLACES:] mp1");
            }
            else
            {
                 SendClientMessage(playerid, COLOR_GRAD2, "You are not at the Info Machine near Unity.");
            }
        }}
        return 1;
    }



Re: [NEEDHELP] Problem with a command - ImprezBart - 21.05.2011

That one worked, thanks man.


Re: [NEEDHELP] Problem with a command - DeathOnaStick - 21.05.2011

Quote:
Originally Posted by ImprezBart
Посмотреть сообщение
That one worked, thanks man.
You're welcome


Re: [NEEDHELP] Problem with a command - ImprezBart - 21.05.2011

Oh, now it automatically sets a marker when i only do /whereis, I need like /whereis mp1 after that it will set a marker, can you change that?


Re: [NEEDHELP] Problem with a command - DeathOnaStick - 21.05.2011

Quote:
Originally Posted by ImprezBart
Посмотреть сообщение
Oh, now it automatically sets a marker when i only do /whereis, I need like /whereis mp1 after that it will set a marker, can you change that?
Okay I think I understood now. Try this one:
pawn Код:
if(strcmp(cmd,"/whereis",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 3.0, 1757.1124,-1943.9635,13.5684)){ // INFO
            new x_nr[32];
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid,COLOR_GRAD4,"Welcome to {33CCFF}Logical Roleplay's {D8D8D8}Map!");
                SendClientMessage(playerid,COLOR_GRAD4,"[PLACES:] mp1");
            }
            if(strcmp(x_nr,"mp1",true) == 0)
            {
                SendClientMessage(playerid,COLOR_GRAD4,"{FF0000}Material Pickup 1 {D8D8D8}has been marked on your map");
                SetPlayerCheckpoint(playerid, 2183.4563,-1502.8416,23.9568, 3.0); //MP1
            }
        }
        else
            {
                 SendClientMessage(playerid, COLOR_GRAD2, "You are not at the Info Machine near Unity.");
            }}
        return 1;
    }
Does this work like it should?