something wrong in the code ||| +REP
#1

Hello guys!

I got errors in the code that is okay, but in the other code, what is same like this, there are no errors

pawn Код:
CMD:groupinvite(playerid, params[])
{
    if(group[playerid][order] != 1) return SendClientMessage(playerid, 0xFF7F50, "You are not the leader of the group, you cannot invite people!");
    new cid;
    if(isnull(params)) return SendClientMessage(playerid, 0xFF7F50, "Usage: /Groupinvite(playerid)"); // line 22986
    cid = strval(params);
    if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF7F50, "Player Is not connected!");
    if(group[cid][gid] == group[playerid][gid]) return SendClientMessage(playerid, 0xFF7F50, "Player Is already in your group!");
    if(group[cid][invited] == group[playerid][gid]) return SendClientMessage(playerid, 0xFF7F50, "Player has already been invited to your group!");
    if(group[cid][attemptjoin] == group[playerid][gid]) return GroupJoin(cid, group[playerid][gid]);
    group[cid][invited] = group[playerid][gid];
    new string[125], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(string, sizeof(string), "{FF7F50}You have been invited to join group %s(%d) by %s(%d). Type /groupjoin %d to join the group.", groupinfo[group[playerid][gid]][grname], group[playerid][gid], pname, playerid, group[playerid][gid]);
    SendClientMessage(cid, 0xFFCC66, string);
    GetPlayerName(cid, pname, 24);
    format(string, sizeof(string), "You have invited {FF7F50}%s(%d){FF7F50} to join your group!", pname, cid);
    SendClientMessage(playerid, 0xFFCC66, string);
    return 1;
}

CMD:groupleader(playerid, params[])
{
    if(group[playerid][order] != 1) return SendClientMessage(playerid, 0xFF7F50, "You are not the leader of the group, you cannot change the leader!");
    new cid;
    if(isnull(params)) return SendClientMessage(playerid, 0xFF7F50, "Usage: /Groupleader(playerid)"); // line 23007
    cid = strval(params);
    if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF7F50, "Player Is not connected!");
    if(cid == playerid)  return SendClientMessage(playerid, 0xFF7F50, "You are already group leader, silly.");
    if(group[playerid][gid] != group[cid][gid]) return SendClientMessage(playerid, 0xFF7F50, "Player Is not in your group!");
    ChangeMemberOrder(group[playerid][gid], 1);
    group[playerid][order] = GroupMembers(group[playerid][gid]);
    return 1;
}

CMD:groupjoin(playerid, params[])
{
    if(group[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF7F50, "You are already in a group! Leave your current one before joining another one!");
    new grid;
    if( (isnull(params) && group[playerid][invited] != -1 ) || ( strval(params) == group[playerid][invited] && group[playerid][invited] != -1) ) return GroupJoin(playerid, group[playerid][invited]); // line 23021
    if(isnull(params)) return SendClientMessage(playerid, 0xFF7F50, "Usage: {FFFFFF}/groupjoin (groupid)");
    grid = strval(params);
    if(!groupinfo[grid][active]) return SendClientMessage(playerid, 0xFF7F50, "The group you have tried to join doesn't exist!");
    group[playerid][attemptjoin] = grid;
    new string[125], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(string, sizeof(string), "You have requested to join group %s(ID:%d)", groupinfo[grid][grname], grid);
    SendClientMessage(playerid, 0xFFCC66, string);
    format(string, sizeof(string), "{FF7F50}%s(%d) has requested to join your group. Type /groupinvite %d to accept", pname, playerid, playerid);
    SendMessageToLeader(grid, string);
    return 1;
}
Errors:
pawn Код:
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\pawno\include\sscanf2.inc(101) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(22986) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(22986) : error 001: expected token: ")", but found "return"
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23007) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23007) : error 001: expected token: ")", but found "return"
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : error 001: expected token: ";", but found "]"
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : fatal error 107: too many error messages on one line

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


8 Errors.
Help and get +REP
Reply
#2

Well first, the lines 22986 and 23007, its that you put
pawn Код:
if(isnull(params))
The params parameter is a string, not a number. You have to define it as a integer.
Replace line 23021 with this:
pawn Код:
if(isnull(params) && group[playerid][invited] != -1  ||  strval(params) == group[playerid][invited] && group[playerid][invited] != -1 ) return GroupJoin(playerid, group[playerid][invited]); // line 23021
Tell me the results!
Reply
#3

now this
pawn Код:
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : error 001: expected token: ";", but found ")"
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\samp03e_svr_R2_win32\gamemodes\nbtdm.pwn(23021) : fatal error 107: too many error messages on one line
What about other errors ?
Reply
#4

Hmm, Hope someone would help to fix this code..
Reply
#5

pawn Код:
CMD:groupjoin(playerid, params[])
{
    if(group[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF7F50, "You are already in a group! Leave your current one before joining another one!");
    new grid;
    if(isnull(params) && group[playerid][invited] != -1  ||  strval(params) == group[playerid][invited] && group[playerid][invited] != -1 ) return GroupJoin(playerid, group[playerid][invited]); // line 23021
    if(isnull(params)) return SendClientMessage(playerid, 0xFF7F50, "Usage: {FFFFFF}/groupjoin (groupid)");
    grid = strval(params);
    if(!groupinfo[grid][active]) return SendClientMessage(playerid, 0xFF7F50, "The group you have tried to join doesn't exist!");
    group[playerid][attemptjoin] = grid;
    new string[125], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(string, sizeof(string), "You have requested to join group %s(ID:%d)", groupinfo[grid][grname], grid);
    SendClientMessage(playerid, 0xFFCC66, string);
    format(string, sizeof(string), "{FF7F50}%s(%d) has requested to join your group. Type /groupinvite %d to accept", pname, playerid, playerid);
    SendMessageToLeader(grid, string);
    return 1;
}
Try that, shouldn't put out any errors.
Reply
#6

Problem solved!
I forgot to define isnull (facepalm)

Lock please

I mean:
Code was okay, but isnull was not defined...
Reply
#7

That's good if the problem solved.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)