01.08.2015, 15:50
Tengo una duda con el "return 1" al momento de usar sscanf, al yo tener un comando asi:
es necesario poner "return 1" al final de cada if?
pawn Код:
CMD:vender(playerid, params[])
{
new item[30],item2,item3,item4;
//
if(!sscanf(params,"s[32]",item))
{
if(strcmp(item,"coche",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender coche");
}
if(strcmp(item,"negocio",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender negocio");
}
if(strcmp(item,"casa",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender casa");
}
if(strcmp(item,"cosecha",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender cosecha");
}
}
//
if(!sscanf(params,"s[32]d",item,item2))
{
if(strcmp(item,"pez",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender pez [fish]");
}
if(strcmp(item,"bebida",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender bebida [playerid]");
}
}
//
if(!sscanf(params,"s[32]ui",item,item2,item3))
{
if(strcmp(item,"arma",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender arma [ID] [Precio]");
}
if(strcmp(item,"micoche",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender micoche [ID] [Precio]");
}
if(strcmp(item,"micasa",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender micasa [ID] [Precio]");
}
}
//
if(!sscanf(params,"s[32]udi",item,item2,item3,item4))
{
if(strcmp(item,"hierba",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender hierba [playerid] [Monto] [Precio]");
}
if(strcmp(item,"crack",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender crack [playerid] [Monto] [Precio]");
}
if(strcmp(item,"materiales",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender materiales [playerid] [Monto] [Precio]");
}
}
//
return 1;
}
pawn Код:
if(strcmp(item,"materiales",true)==0)
{
SendClientMessageEx(playerid,-1, "/vender materiales [playerid] [Monto] [Precio]");
return 1;
}