08.06.2012, 17:37
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;
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;
}
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;
}
pawn Код:
|
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
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;
}
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;
}
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;
}
pawn Код:
|