29.11.2014, 22:54
boa noite,alguem mim ajuda a passar pra sscanf2 pf http://pastebin.com/4UyeD5ij
CMD:addentradahouse(playerid, params[])
{
if(Player[playerid][pAdmin] < 7)
return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo tem permissгo para usar este comando!");
new h;
if(sscanf(params, "i", h))
return SendClientMessage(playerid, COLOR_GREY, "[USO] /addentradacasa [houseid] - Move a casa atй vocк.");
if(h > sizeof(HouseInfo) || h < 0)
return SendClientMessage(playerid,COLOR_RED, "[ERRO] O ID da casa deve ser de 0 а 64.");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
format(thestring,sizeof(thestring)," %s mudou a entrada da casa %d para %f - %f - %f",Player[playerid][pName],h,X,Y,Z);
WriteLog("rpedits", thestring);
ABroadCast(COLOR_YELLOW,thestring,5);
HouseInfo[h][hEntrancex] = X;
HouseInfo[h][hEntrancey] = Y;
HouseInfo[h][hEntrancez] = Z;
DestroyDynamicPickup(HouseInfo[h][hIcon]);
Delete3DTextLabel(HouseInfo[h][HouseLabel]);
if(HouseInfo[h][hOwned] == 1)
{
HouseInfo[h][hIcon] = CreateDynamicPickup(1239, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
if(HouseInfo[h][hRentabil] == 0)
format(thestring, sizeof(thestring), "Proprietбrio da casa: %s \nLevel : %d",hOwner[h],HouseInfo[h][hLevel]);
else
format(thestring, sizeof(thestring), "Proprietбrio da casa: %s \nAluguel: R$ %d - Level : %d \nDigite /alugarcasa para alugar um quarto",hOwner[h],HouseInfo[h][hRent],HouseInfo[h][hLevel]);
HouseInfo[h][HouseLabel] = Create3DTextLabel(thestring ,COLOR_WHITE, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1.0,30.0,0);
}
if(HouseInfo[h][hOwned] == 0)
{
HouseInfo[h][hIcon] = CreateDynamicPickup(1273, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
format(thestring, sizeof(thestring), "A casa estб a venda \n Descricгo: %s \n Preco: R$ %d - Level : %d\n Para comprar digite /comprarcasa",hDiscription[h],HouseInfo[h][hValue],HouseInfo[h][hLevel]);
HouseInfo[h][HouseLabel] = Create3DTextLabel(thestring ,COLOR_WHITE, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1.0,30.0,0);
}
pickups++;
OnPropUpdate();
return 1;
}
CMD:addspawn(playerid, params[])
{
if(Player[playerid][pAdmin] < 7)
return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo tem permissгo para usar este comando!");
new proplev;
if(sscanf(params, "i", proplev))
return SendClientMessage(playerid, COLOR_GREY, "[USO] /addspawn [houseid]");
if(proplev > sizeof(HouseInfo) || proplev < 0)
return SendClientMessage(playerid,COLOR_RED, "[ERRO] O ID da casa deve ser de 0 а 91.");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
format(thestring,sizeof(thestring),"Spawn da casa %d mudada %f - %f - %f",proplev,X,Y,Z);
ABroadCast(COLOR_YELLOW,thestring,5);
HouseInfo[proplev][hExitx] = X;
HouseInfo[proplev][hExity] = Y;
HouseInfo[proplev][hExitz] = Z;
OnPropUpdate();
return 1;
}
1° e ъltima vez que faзo isso, nгo venha para o fуrum apenas pedir coisas prontas.
Aqui Se der erro sу avisar e falar qual linha estб dando erro #edit Desculpe PT, eu estava fazendo a conversгo, e nгo vi vocк postar... |
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kick", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid]");
new id = strval(tmp);
Kick(id);
return 1;
}
return 0;
}
CMD:kick(playerid, params[])
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid]");
Kick(strval(tmp));
return 1;
}
if(sscanf(params, "u", id))
// no lugar do params deve ser colocado a string que deseja separar, e onde estб o "u" й o formato para identificar se vai ser armazenado em um string, float, variбvel...
//Nгo vou entrar em detalhes, veja os tutoriais sobre sscanf.
// E o id й onde vai ser armazenado uma parte da string que vai ser separada.
CMD:kick(playerid, params[])
{
new id; // variбvel onde vai ser armazenado o id. O sscanf separa a string
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "Mensagem de erro pois falta algum parвmetro.");
Kick(id);
return 1;
}