PDA

View Full Version : error 029: invalid expression, assumed zero [please Help]


SpikY_
01/08/2014, 11:31 AM
i have usf gamemode .. there are not much admin cmds .. so i was adding more cmds .. like /setalltime etc

when i added so it given me alot of errors , so plz solve it

Codes are :

Error codes:


D:\server\gamemodes\usfMain.pwn(4585) : warning 225: unreachable code
D:\server\gamemodes\usfMain.pwn(4585) : error 029: invalid expression, assumed zero
D:\server\gamemodes\usfMain.pwn(4585) : warning 215: expression has no effect
D:\server\gamemodes\usfMain.pwn(4585) : error 001: expected token: ";", but found "return"
D:\server\gamemodes\usfMain.pwn(4585) : error 017: undefined symbol "ShowMessage"
D:\server\gamemodes\usfMain.pwn(4585) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

now lines :

4572 CMD:setalltime(playerid, params[])
4573 {
4574 if (PlayerInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are 4575 not authorized to use this command!");
4576 {
4577 new time;
4578 if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "Usage: /settime <Time>");
4579 if(time > 24 || time < 0) return SendClientMessage(playerid, red, "Error: Invalid Time!");
4580 new str[100];
4581 format(str, sizeof(str), "%s has changed time to '%d'",GetName(playerid),time);
4582 SendClientMessageToAll(-1,str);
4583 SetWorldTime(time);
4584 return 1;
4585 }
4586 else return ShowMessage(playerid, red, 1);
4587 }

Steel_
01/08/2014, 11:33 AM
ShowMessage is not a samp callback and you cant add (playerid, red, 1); in a return
just try return 1;

SpikY_
01/08/2014, 11:37 AM
You mean like this

else return ShowMessage(1);
}

Battlezone
01/08/2014, 11:40 AM
CMD:setalltime(playerid, params[])
{
if (PlayerInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are not authorized to use this command!");
new time;
if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "Usage: /settime <Time>");
if(time > 24 || time < 0) return SendClientMessage(playerid, red, "Error: Invalid Time!");
new str[100];
format(str, sizeof(str), "%s has changed time to '%d'",GetName(playerid),time);
SendClientMessageToAll(-1,str);
SetWorldTime(time);
return 1;
}