SA-MP Forums Archive
Help with these commands? - 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: Help with these commands? (/showthread.php?tid=421547)



Help with these commands? - Qaiis - 09.03.2013

This command only set myslef leader, whats wrong? If i type another ID, it still set myself.

Код:
CMD:setleader(playerid, params[])
{
	new id;
	if(admin[playerid] < 3) return SendClientMessage(playerid, 0xFF000000, "Your not an admin with right lvl.");
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2512.8247,-1664.4379,13.5784)) return SendClientMessage(playerid, 0xFF000000, "Go to the HQ you want to set the leader.");
 	if(sscanf(params,"ui", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setleader [id]");
	SendClientMessage(id, 0x99FF0000, "~You have been made an leader of Grove Street Families~");
	SendClientMessage(playerid, 0x99FF0000, "Leader have been set!");
	gsfmember[id] = 2;
	return 1;
}
and also, how could i make a cmd that sets a member if i want to use this:

Код:
if(request[id] == 2) return SendClientMessage(playerid, 0xFF000000, "This player is not requesting to join your organization!");



Re: Help with these commands? - Rock - 09.03.2013

Read sscanf topic.
Parameter "u" is for playerid and in your cause it's only needed.
Код:
if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setleader [id]");
"i" is for integrer.(number, 1,2,3..100,10000, etc)

And for the second problem I don't understand what you mean.


Re: Help with these commands? - Qaiis - 09.03.2013

pawn Код:
CMD:setmember(playerid, params[])
{
    new id;
    if(gsfmember[playerid] < 2) return SendClientMessage(playerid, 0xFF000000, "You cannot use this command");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setmember [id]");
    SendClientMessage(id, 0x99FF0000, "~You have been made a member of Grove Street Families~");
    SendClientMessage(playerid, 0x99FF0000, "Member have been set!");
    gsfmember[id] = 1;
    return 1;
}
Now can i set random player as members, but i want it like they have to /request first.

Also, thank you!


Re: Help with these commands? - Rock - 09.03.2013

Not tested!
pawn Код:
// top of script
new
    bool: Requested[ MAX_PLAYERS ] = false
;

CMD:request( playerid )
{
    if( Requested[ playerid ] == true )
    {
        SendClientMessage( playerid, -1, "You already requested" );
    }
    else
    {
        Requested[ playerid ] = false;
    }
    return 1;
}

CMD:setmember(playerid, params[])
{
    new id;
    if(gsfmember[playerid] < 2) return SendClientMessage(playerid, 0xFF000000, "You cannot use this command");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setmember [id]");
    if(Requested[ id ] == false)
    {
        SendClientMessage(id, 0x99FF0000, "~You have been made a member of Grove Street Families~");
        SendClientMessage(playerid, 0x99FF0000, "Member have been set!");
        gsfmember[id] = 1;
    }
    return 1;
}



Re: Help with these commands? - Qaiis - 09.03.2013

pawn Код:
Orgsystem.pwn(329) : error 029: invalid expression, assumed zero

pawn Код:
CMD:setmember(playerid, params[])
{
    new id;
    if(gsfmember[playerid] < 2) return SendClientMessage(playerid, 0xFF000000, "You cannot use this command");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setmember [id]");
    if(request[id] == 1) else SendClientMessage(playerid, 0xFF000000, "This player is not requesting to join your organization!");
    {
        SendClientMessage(id, 0x99FF0000, "~You have been made a member of Grove Street Families~");
        SendClientMessage(playerid, 0x99FF0000, "Member have been set!");
        gsfmember[id] = 1;
    }
    return 1;
}



Re: Help with these commands? - Rock - 09.03.2013

Код:
request[id] == 1
This should be "true" or "false" as the example i've given you, not 1 or 0.
And you are using a different variable, I used "Requested" not request.

EDIT:
Didn't see that "else" there, it should be return.
pawn Код:
CMD:setmember(playerid, params[])
{
    new id;
    if(gsfmember[playerid] < 2) return SendClientMessage(playerid, 0xFF000000, "You cannot use this command");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setmember [id]");
    if(Requested[id] == false) return SendClientMessage(playerid, 0xFF000000, "This player is not requesting to join your organization!");
    {
        SendClientMessage(id, 0x99FF0000, "~You have been made a member of Grove Street Families~");
        SendClientMessage(playerid, 0x99FF0000, "Member have been set!");
        gsfmember[id] = 1;
    }
    return 1;
}



AW: Help with these commands? - morocco - 09.03.2013

Look this ?
http://pastebin.com/UZY53m0R

just change id Faction and mafia for your GM


Re: Help with these commands? - Qaiis - 10.03.2013

Quote:
Originally Posted by Rockk
Посмотреть сообщение
Код:
request[id] == 1
This should be "true" or "false" as the example i've given you, not 1 or 0.
And you are using a different variable, I used "Requested" not request.

EDIT:
Didn't see that "else" there, it should be return.
pawn Код:
CMD:setmember(playerid, params[])
{
    new id;
    if(gsfmember[playerid] < 2) return SendClientMessage(playerid, 0xFF000000, "You cannot use this command");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setmember [id]");
    if(Requested[id] == false) return SendClientMessage(playerid, 0xFF000000, "This player is not requesting to join your organization!");
    {
        SendClientMessage(id, 0x99FF0000, "~You have been made a member of Grove Street Families~");
        SendClientMessage(playerid, 0x99FF0000, "Member have been set!");
        gsfmember[id] = 1;
    }
    return 1;
}
Thank you. But why does this command send both of the messages to myself and sets myself leader?

pawn Код:
CMD:setleader(playerid, params[])
{
    new id;
    if(admin[playerid] < 3) return SendClientMessage(playerid, 0xFF000000, "Your not an admin with right lvl.");
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2512.8247,-1664.4379,13.5784)) return SendClientMessage(playerid, 0xFF000000, "Go to the HQ you want to set the leader.");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE:/setleader [id]");
    format(outp,sizeof(outp),"%s gave you the leadership of Grove Street Families!",PlayerName(playerid));
    SendClientMessage(id, 0xd0d18100,outp);
    format(outp,sizeof(outp),"You sat %s as leader of Grove Street Families!",PlayerName(id));
    SendClientMessage(playerid, 0xd0d18100,outp);
    gsfmember[id] = 2;
    return 1;
}



Re: Help with these commands? - Sandiel - 10.03.2013

pawn Код:
CMD:setleader(playerid, params[])
{
     new id;
     if(!sscanf(params,"u", id))
     {
         // Do your thing, set "id" as leader.
     }
     return 1;
}