SA-MP Forums Archive
/crime command errors - 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: /crime command errors (/showthread.php?tid=289902)



/crime command errors - Cirtical - 13.10.2011

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.



AW: /crime command errors - Drebin - 13.10.2011

Which of these lines is 60828 and 60829 ?


Re: /crime command errors - SmiT - 13.10.2011

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



Re: /crime command errors - Cirtical - 13.10.2011

60828 new y, m, d;
60829 new h,mi,s;


AW: /crime command errors - Drebin - 13.10.2011

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.


Re: /crime command errors - Cirtical - 13.10.2011

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.


Re: /crime command errors - volune - 13.10.2011

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


AW: /crime command errors - Drebin - 13.10.2011

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