/crime command errors
#1

Well guys, I have tried to edit the /crime command because it's bugged. It's supposed to say why the player is wanted.

Pawno code:
Код:
	if(strcmp(cmd, "/crime", true) == 0) // By Weso_Mousa
	{
		if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /crime [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					format(string, sizeof(string), "[INFO]: %s's crime : %s", PlayerCrime[giveplayerid][pAccusedof]);,	format(string, sizeof(string),
					new y, m, d;
					new h,mi,s;
					getdate(y,m,d);
					gettime(h,mi,s);
					format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Checked %s's crime.",d,m,y,h,mi,s,sendername,giveplayer);
					GiveLog(string);
			    }
			}
			else
			{
				format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

Error:

Код:
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60828) : error 029: invalid expression, assumed zero
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60828 -- 60829) : error 029: invalid expression, assumed zero
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60829) : error 017: undefined symbol "y"
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60829) : fatal error 107: too many error messages on one line

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


4 Errors.
Reply
#2

Which of these lines is 60828 and 60829 ?
Reply
#3

Well, check this line out:
pawn Код:
format(string, sizeof(string), "[INFO]: %s's crime : %s", PlayerCrime[giveplayerid][pAccusedof]);,  format(string, sizeof(string),
Reply
#4

60828 new y, m, d;
60829 new h,mi,s;
Reply
#5

pawn Код:
format(string, sizeof(string), "[INFO]: %s's crime : %s", PlayerCrime[giveplayerid][pAccusedof]);
But still: you have 2 places to insert a string (%s) but you put only one string into it.
Reply
#6

C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60812) : warning 217: loose indentation
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60846) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#7

Quote:
Originally Posted by Cirtical
Посмотреть сообщение
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60812) : warning 217: loose indentation
C:\Documents and Settings\wesso\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(60846) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
use TAB on the code
Reply
#8

pawn Код:
if(strcmp(cmd, "/crime", true) == 0) // By Weso_Mousa
{
    if(IsPlayerConnected(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /crime [playerid/PartOfName]");
            return 1;
        }
        giveplayerid = ReturnUser(tmp);
        if(IsPlayerConnected(giveplayerid))
        {
            if(giveplayerid != INVALID_PLAYER_ID)
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "[INFO]: %s's crime : %s", PlayerCrime[giveplayerid][pAccusedof]);
                new y, m, d;
                new h,mi,s;
                getdate(y,m,d);
                gettime(h,mi,s);
                format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Checked %s's crime.",d,m,y,h,mi,s,sendername,giveplayer);
                GiveLog(string);
            }
        }
        else
        {
            format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)