[NEEDHELP] Problem with a command
#1

Код:
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
Reply
#2

Please mark me line 35193.
Reply
#3

Here you go.
Quote:

new x_nr[32];

Reply
#4

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.
Reply
#5

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)

Reply
#6

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;
    }
Reply
#7

That one worked, thanks man.
Reply
#8

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

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?
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)