More org help need.
#1

Can you tell me what is the problem with my request command? Because when i request different ids, it sill says that i am requesting SAPD.

Example:

/request 1. Will show that i am requesting SAPD
/request 2. Should show that i am requesting SAH but is shows that i am requesting SAPD.

pawn Код:
COMMAND:request(playerid, params[])
{
    new id;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
    new string[MAX_PLAYERS],Name[MAX_PLAYERS];
    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!");
    format(string,255,"* %s is requesting to join San Andreas Police Dept.",Name);
     SendClientMessageToAll(0xFFFFFFFF,string);
     request[playerid] = 1;
     IsRequesting[playerid] = 1;
    {
    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!");
    format(string,255,"* %s is requesting to join San Andreas Street Racers.",Name);
     SendClientMessageToAll(0xFFFFFFFF,string);
     request[playerid] = 1;
     IsRequesting[playerid] = 1;
    }
    return 1;
}
}
Reply
#2

Please help.
Reply
#3

Give this a try (havnt tested need your functions) hope it works
pawn Код:
COMMAND:request(playerid, params[])
{
    new id;
    if(sscanf(params,"d", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /request [orgid]");
    new string[128],Name[MAX_PLAYER_NAME];
    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,128,"* %s is requesting to join San Andreas Police Dept.",Name);
        SendClientMessageToAll(0xFFFFFFFF,string);
        request[playerid] = 1;
        IsRequesting[playerid] = 1;
        return 1;
    }
    if(id == 2)
    {
        format(string,128,"* %s is requesting to join San Andreas Street Racers.",Name);
        SendClientMessageToAll(0xFFFFFFFF,string);
        request[playerid] = 1;
        IsRequesting[playerid] = 1;
    }
    return 1;
}
Advice: Use the correct size arrays for strings/names. In sscanf the 'u' specifier is for names so use 'd' if its an integer value.
Reply
#4

OK will do.

EDIT: Iggy thanks <3 it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)