/setfaction
#1

I've fixed it.

wiki.sa-mp.com ftw. Answers to everything.
Reply
#2

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
Reply
#3

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.
Reply
#4

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

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.
Reply
#6

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?>
Reply
#7

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.
Reply
#8

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;
}
Reply
#9

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.
Reply
#10

Admin please close. I fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)