SA-MP Forums Archive
/setfaction - 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: /setfaction (/showthread.php?tid=292835)



/setcompany [rep+] - Chriham3 - 25.10.2011

I've fixed it.

wiki.sa-mp.com ftw. Answers to everything.


Re: /setfaction - LetsOWN[PL] - 25.10.2011

You've to use SSCANF.
For e.g.
pawn Код:
new id, num;
if(sscanf(params, "ud", id, num)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /commandname [id] [number - perhaps 666?]");
return 1;
}
Good luck!

LetsOWN


Re: /setfaction - Chriham3 - 25.10.2011

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
You've to use SSCANF.
For e.g.
pawn Код:
new id, num;
if(sscanf(params, "ud", id, num)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /commandname [id] [number - perhaps 666?]");
return 1;
}
Good luck!

LetsOWN
Can you please explain each line? Im not good with sscanf.


Re : /setfaction - Naruto_Emilio - 25.10.2011

https://sampforum.blast.hk/showthread.php?tid=206237


Re: /setfaction - Chriham3 - 25.10.2011

Can't get it to work. I did:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    COMMAND:setfaction(playerid, params[])
    {
    new id, num;
    if(sscanf(params, "ud", id, num)
    {
    SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setfaction [id] [faction id (1-15)]");
    return 1;
    }
}
got error message:
Код:
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : error 029: invalid expression, assumed zero
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : error 017: undefined symbol "cmd_setcompany"
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : error 029: invalid expression, assumed zero
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : fatal error 107: too many error messages on one line

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


4 Errors.



Re: /setfaction - Elka_Blazer - 25.10.2011

Quote:
Originally Posted by Chriham3
Посмотреть сообщение
Can't get it to work. I did:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    COMMAND:setfaction(playerid, params[])
    {
    new id, num;
    if(sscanf(params, "ud", id, num)
    {
    SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setfaction [id] [faction id (1-15)]");
    return 1;
    }
}
got error message:
Код:
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : error 029: invalid expression, assumed zero
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : error 017: undefined symbol "cmd_setcompany"
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : error 029: invalid expression, assumed zero
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(239) : fatal error 107: too many error messages on one line

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


4 Errors.
Line 239?>


Re: /setfaction - Chriham3 - 25.10.2011

Ok, so I fixed the error.
Updated the main post, so please take a look and please see if you can help me with that one.


Respuesta: /setfaction - Super_Panda - 25.10.2011

pawn Код:
COMMAND:setfaction(playerid, params[])
{
    new id, num;
    if(sscanf(params, "ud", id, num) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setfaction [id] [faction id (1-15)]");
    {

        //Your code

    }
    return 1;
}



Re: Respuesta: /setfaction - Chriham3 - 25.10.2011

Quote:
Originally Posted by Super_Panda
Посмотреть сообщение
pawn Код:
COMMAND:setfaction(playerid, params[])
{
    new id, num;
    if(sscanf(params, "ud", id, num) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setfaction [id] [faction id (1-15)]");
    {

        //Your code

    }
    return 1;
}
Erm, if you just throw codes at me like that I don't learn anything, and by reading the command, I can not see that the [Faction] value has changed, so the command is not complete. I want to know how to make it so it sets the [Faction] value to the set faction value in the command to the player id that was entered in the command.


Re: /setfaction - Chriham3 - 25.10.2011

Admin please close. I fixed it.