[Ajuda] sscanf "u"
#1

quando coloco "u" no sscanf ele nгo retorna como id do player:

pawn Код:
CMD:setmoney(playerid,params[])
{
    if(PlayerStats[playerid][Level] >= 3){
    new id,val;
    if(sscanf(params, "ud",id,val)) return SendClientMessage(playerid, vermelho, "Use: /money [quantia]");
    if(val > 999999999) return SendClientMessage(playerid, vermelho, "[ERRO]: Quantia invalida!");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, vermelho, "Jogador nгo conectado!");
    SetPlayerMoney(id,val);
    SendFmtdMsg(playerid,COLOR_FOR_ADMIN,"|-- Vocк deu %d$ em dinheiro para %s --|",val,GetPlayerNameMk(id));
    SendFmtdMsg(id,COLOR_FOR_PLAYER,"|-- O admin %s lhe deu %d$ em dinheiro --|",GetPlayerNameMk(playerid),val);
    }
    else return false;
    return 1;
}
mas quando coloco "d" ele funciona normal:
pawn Код:
CMD:setmoney(playerid,params[])
{
    if(PlayerStats[playerid][Level] >= 3){
    new id,val;
    if(sscanf(params, "dd",id,val)) return SendClientMessage(playerid, vermelho, "Use: /money [quantia]");
    if(val > 999999999) return SendClientMessage(playerid, vermelho, "[ERRO]: Quantia invalida!");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, vermelho, "Jogador nгo conectado!");
    SetPlayerMoney(id,val);
    SendFmtdMsg(playerid,COLOR_FOR_ADMIN,"|-- Vocк deu %d$ em dinheiro para %s --|",val,GetPlayerNameMk(id));
    SendFmtdMsg(id,COLOR_FOR_PLAYER,"|-- O admin %s lhe deu %d$ em dinheiro --|",GetPlayerNameMk(playerid),val);
    }
    else return false;
    return 1;
}
por que acontece isso sendo que "u" й especifico para o playerid?
Reply
#2

Tenta assim :

pawn Код:
if(sscanf(params, "rd",id,val))
Reply
#3

ainda acontece a mesma coisa. ta retornado:

if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Jogador nгo conectado!");


mesmo quando tiro essas linhas:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Jogador nгo conectado!");
if(val > 999999999) return SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: Quantia invalida!");

nгo acontece nada
Reply
#4

Que versгo de sscanf e do SA:MP vocк tб usando?
Reply
#5

uso o sscanf 2.6
nгo й o update mais recente porque o novo update da Loading Failed
Reply
#6

Qual versгo do SA:MP?
Reply
#7

eu uso o 3d mais no samp 3e tambйm acontece o mesmo

server cfg:
Код:
echo Executing Server Config...
lanmode 0
rcon_password 1480
maxplayers 5
port 5018
hostname SA-MP 0.3 Server
gamemode0 new
filterscripts
plugins sscanf
announce 0
query 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
password 1480
logtimeformat [%H:%M:%S]
eu observei na include:

/*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the sscanf 2.0 SA:MP plugin.
*
* The Initial Developer of the Original Code is Alex "******" Cole.
* Portions created by the Initial Developer are Copyright © 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Special Thanks to:
*
* SA:MP Team past, present and future
*/

native sscanf(const data[], const format[], {Float,_}:...);
native unformat(const data[], const format[], {Float,_}:...) = sscanf;


й a 2.0

a 2.6 que da Loading Failed*
Reply
#8

no samp 0.3e sу funciona a nova atualizaзгo. aconteceu comigo tbm.
Reply
#9

antes de mim formatar o pc todas as versхes funcionavam normalmente, mais ja instalei tudo que poderia ser possнvel
java, microsoft c++ library, net framework... nada adiantou :/
Reply
#10

para corrigir a falha de pegar o id automбtico usando o nome do jogador vocк precisa atualizar todos os arquivos do sscanf(includes, arquivos etc)
para a nova versгo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)