[HELP]Commands sscanf & zcmd
#1

help, how can I create the command /world id in zcmd with sscanf, limit is 99 example.. and in the command set the variable Worlds[playerid] = 1;
Reply
#2

pawn Код:
CMD:world(playerid , params[])
{
  new world;
  if(sscanf(params,"i",world)) return SendClientMessage(playerid,-1,"/word <worldid>");
  if(0=< world < 99)
  {
    SetPlayerVirtualWorld(playerid,world);
// set variable to player worldid ?
    Worlds[playerid] = world;
    SendClientMessage(playerid,-1,"Success!");
  }else return SendClientMessage(playerid,-1,"Valid id 0-99");
  return 1;
}
Reply
#3

pawn Код:
CMD:world(playerid, params[])
{
    new id;
    if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "Usage: /world [id]");
    if(id > 99 || id < 0) return SendClientMessage(playerid, -1, "Limit: 0-99);
    Worlds[playerid] = id;
    return 1;
}
Not quite sure what you wanted. Didn't know whether to make Worlds = id, or make it one. I just made it so that it sets the players Worlds variable to the id the put in.

EDIT: Looks like I was too late.
Reply
#4

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
pawn Код:
CMD:world(playerid , params[])
{
  new world;
  if(sscanf(params,"i",world)) return SendClientMessage(playerid,-1,"/word <worldid>");
  if(0=< world < 99)
  {
    SetPlayerVirtualWorld(playerid,world);
// set variable to player worldid ?
    Worlds[playerid] = world;
    SendClientMessage(playerid,-1,"Success!");
  }else return SendClientMessage(playerid,-1,"Valid id 0-99");
  return 1;
}
dosent work

Код:
 warning 219: local variable "i" shadows a variable at a preceding level
warning 211: possibly unintended assignment
error 022: must be lvalue (non-constant)
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
fatal error 107: too many error messages on one line
Reply
#5

bump
Reply
#6

pawn Код:
CMD:world(playerid,params[])
{
    new world;
    if(!('0' <= params[0] <= '9')) SendClientMessage(playerid,-1,"/word <worldid>");
    else if(!(0 <= (world = strval(params)) <= 99)) SendClientMessage(playerid,-1,"Valid id 0-99");
    else{
        SetPlayerVirtualWorld(playerid,world);
        Worlds[playerid] = world;
        SendClientMessage(playerid,-1,"Success!");
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
CMD:world(playerid,params[])
{
    new world;
    if(!('0' <= params[0] <= '9')) SendClientMessage(playerid,-1,"/word <worldid>");
    else if(!(0 <= (world = strval(params)) <= 99)) SendClientMessage(playerid,-1,"Valid id 0-99");
    else{
        SetPlayerVirtualWorld(playerid,world);
        Worlds[playerid] = world;
        SendClientMessage(playerid,-1,"Success!");
    }
    return 1;
}
if(!('0' <= params[0] <= '9')) SendClientMessage(playerid,-1,"/word <worldid>"); --->>>> 9 ?
Reply
#8

pawn Код:
CMD:world(playerid,params[])
{
    new world;
    if(!('0' <= params[0] <= '9')) SendClientMessage(playerid,-1,"/World [World ID]");
    else if(!(0 <= (world = strval(params)) <= 99)) SendClientMessage(playerid,-1,"Valid id 0-99");
    else
    {
        SetPlayerVirtualWorld(playerid,world);
        Worlds[playerid] = world;
        SendClientMessage(playerid,-1,"Success!");
    }
    return 1;
}
Reply
#9

pawn Код:
CMD:world(playerid, params[])
{
     new World;
     if(sscanf(params, "d", World)) return SendClientMessage(playerid, -1, "Usage: /world [ID World]");
     if(World < 1 || World > 99) return SendClientMessage(playerid, -1, "[ERROR]: Worlds 1 - 99");
     SetPlayerVirtualWorld(playerid, World);
     return 1;
}
Try.
Reply
#10

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
pawn Код:
CMD:world(playerid, params[])
{
     new World;
     if(sscanf(params, "d", World)) return SendClientMessage(playerid, -1, "Usage: /world [ID World]");
     if(World < 1 || World > 99) return SendClientMessage(playerid, -1, "[ERROR]: Worlds 1 - 99");
     SetPlayerVirtualWorld(playerid, World);
     return 1;
}
Try.
Thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)