Factions help please
#1

im workong on factions and this is where i get the error

Quote:

COMMAND:request(playerid, params[])
{
new id;
if(sscanf(params,"i", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
GetPlayerName(playerid, Name, sizeof(Name));
if(IsInOrg[playerid] == 1) return SendClientMessage(playerid, red," You are already in a organisation!");
if(IsRequesting[playerid] == 1) return SendClientMessage(playerid, red," You are already requesting to join an organisation!");
if(id == 1)
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Police Dept.",Name);
SendClientMessageToAll(SAPD_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 1;
return 1;
}
if(id == 2)
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Street Racers.",Name);
SendClientMessageToAll(SASR_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 2;
return 1;
}
if(id == 3)
{
format(String,MAX_PLAYERS,"* %s is requesting to join Hitmen.",Name);
SendClientMessageToAll(HITMAN_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 2;
return 1;
}
if(id == 4)
{
format(String,MAX_PLAYERS,"* %s is requesting to join The National Guard.",Name);
SendClientMessageToAll(NG_COLOR,String);
IsRequesting[playerid] = 1;
request[playerid] = 2;
return 1;
}
return 1;
}

heres the error log

Quote:

C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(82) : warning 217: loose indentation
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(90) : warning 217: loose indentation
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(99) : warning 217: loose indentation
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(145) : warning 217: loose indentation
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(183) : warning 217: loose indentation
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(259) : warning 219: local variable "id" shadows a variable at a preceding level
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(290) : warning 225: unreachable code
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(290) : warning 217: loose indentation
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(290) : error 029: invalid expression, assumed zero
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(290) : error 017: undefined symbol "cmd_request"
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(290) : error 029: invalid expression, assumed zero
C:\Documents and Settings\gamer\Desktop\MW-DM\filterscripts\Orgs.pwn(290) : fatal error 107: too many error messages on one line

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


4 Errors.

please help idk what to do thanks
Reply
#2

Seems like there's something wrong with your ZCMD. Anyways this code should work:
pawn Код:
COMMAND:request(playerid, params[])
{
    new fid;
    if(sscanf(params,"i ", fid))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
    GetPlayerName(playerid, Name, sizeof(Name));
    if(IsInOrg[playerid] == 1) return SendClientMessage(playerid, red," You are already in a organisation!");
    if(IsRequesting[playerid] == 1) return SendClientMessage(playerid, red," You are already requesting to join an organisation!");
    switch(fid)
    {
        case 1:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Police Dept.",Name);
            SendClientMessageToAll(SAPD_COLOR,String);
            IsRequesting[playerid] = 1;
            request[playerid] = 1;
            return 1;
        }
        case 2:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Street Racers.",Name);
            SendClientMessageToAll(SASR_COLOR,String);
            IsRequesting[playerid] = 1;
            request[playerid] = 2;
            return 1;
        }
        case 3:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join Hitmen.",Name);
            SendClientMessageToAll(HITMAN_COLOR,String);
            IsRequesting[playerid] = 1;
            request[playerid] = 2; // I believe this should be 3?
            return 1;
        }
        case 4:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join The National Guard.",Name);
            SendClientMessageToAll(NG_COLOR,String);
            IsRequesting[playerid] = 1;
            request[playerid] = 2; // and this 4 maybe?
            return 1;
        }
    }
    return 1;
}
Even tho' there's a much more efficent way to do it.
This should also work if you rewrite some of your code:
pawn Код:
COMMAND:request(playerid, params[])
{
    new fid;
    if(sscanf(params,"i ", fid))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
    GetPlayerName(playerid, Name, sizeof(Name));
    if(IsInOrg[playerid] == 1) return SendClientMessage(playerid, red," You are already in a organisation!");
    if(request[playerid] > 0) return SendClientMessage(playerid, red," You are already requesting to join an organisation!");
    if(fid < 1 || fid > 4) return SendClientMessage(playerid, red, " Invalid organisation id, must be between 1-4!");
    switch(fid)
    {
        case 1:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Police Dept.",Name);
            SendClientMessageToAll(SAPD_COLOR,String);
        }
        case 2:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Street Racers.",Name);
            SendClientMessageToAll(SASR_COLOR,String);
        }
        case 3:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join Hitmen.",Name);
            SendClientMessageToAll(HITMAN_COLOR,String);
        }
        case 4:
        {
            format(String,MAX_PLAYERS,"* %s is requesting to join The National Guard.",Name);
            SendClientMessageToAll(NG_COLOR,String);
        }
    }
    request[playerid] = fid;
    return 1;
}
Reply
#3

Neather of them work :/ Iv tryed geting a new ZCMD but mabe its currupted or something anyways when i leave the bottom 2 out it compiles fine so idk whats wrong
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)