zcmd(makeleader, playerid, params[]) { if(Info[playerid][pAdminZC] > 1337 || Info[playerid][pFactionModerator] == 1) { if(!sscanf(params, "di", params[0], params[1])) { new ftext[30]; if(params[1] < 0 || params[1] > MAX_FACTION) return SendClientMessageEx(playerid, COLOR_GREY, "ID facciуn incorrecto."); if(!IsPlayerConnected(params[0])) return SendClientMessageEx(playerid, COLOR_GREY, "Jugado desconectado."); switch(params[1]) { case 0: {Info[params[0]][pRank] = 0; ftext = "Ninguna"; } case 1: {Info[params[0]][pRank] = 6; ftext = "San Andreas Police Department"; } case 2: {Info[params[0]][pRank] = 6; ftext = "FBI"; } case 3: {Info[params[0]][pRank] = 6; ftext = "San Andreas Ejйrcito Militar"; } case 4: {Info[params[0]][pRank] = 6; ftext = "San Andreas Medical Deparment"; } case 5: {Info[params[0]][pRank] = 6; ftext = "SA News"; } case 6: {Info[params[0]][pRank] = 6; ftext = "Mecanicos 24/7"; } case 7: {Info[params[0]][pRank] = 6; ftext = "Gobierno"; } case 8: {Info[params[0]][pRank] = 6; ftext = "Hitman"; } case 9: {Info[params[0]][pRank] = 6; ftext = "Sistema Judicial"; } } new string[128]; pTazer[params[0]] = 0; Info[params[0]][pLeader] = params[1]; Info[params[0]][pMember] = params[1]; format(string, sizeof(string), "Administraciуn: %s te asignу el lнder de la facciуn %s.", GetPlayerNameEx(playerid), ftext); SendClientMessageEx(params[0], 0x6ADFFFFF, string); format(string, sizeof(string), "Administraciуn: %s asigno lider de la facciуn %s a %s.", GetPlayerNameEx(playerid), ftext, GetPlayerNameEx(params[0])); ABroadCast(COLOR_BLUE, string, 3); } else SendClientMessageEx(playerid, COLOR_GRAD2, "USA: /makeleader [jugador] [facciуn]"); } else SendClientMessageEx(playerid, COLOR_GRAD2, "No autorizado."); return 1; }
params[0], params[1]
if(!sscanf(params, "ui", lookupid, factionid))
error 017: undefined symbol "lookupid"
Como dije en otros posts, no hagas esto:
pawn Код:
pawn Код:
|
Mira, me da йste error
Код:
error 017: undefined symbol "lookupid" |
new lookupid;
Hola, que pasa si se usa esto params[0], params[1]?
estoy empezando a usar zcmd y sscanf y hasta ahora lo vengo usando con params[0], params[1]. |
1) Debes definir "lookupid"
2) ZCMD y strmpc son procesadores de comandos distintos, debes cambiar todos tus comandos (la primera lнnea) que dice zcmd(... por la lнnea que lleva strmpc (no me la sй de memoria). strmpc los CMD van en OnPlayerCommandText, no puedes usar ambos procesadores al mismo tiempo. |
CMD:test(playerid, params[])
{
new option[10], lookupid;
sscanf(params, "s[10]i", option, lookupid);
if(strcmp(option, "test", true) == 0)
{
// ....
}
else return 0; // Decirle al servidor que el comando es invalido.
return 1;
}
zcmd(asignar, playerid, params[]) { new asignar[32]; if(sscanf(params, "s[32]", asignar)) { SendClientMessage(playerid, COLOR_WHITE, "Info: Uso correcto: /Asignar faccion [ID Jugador] [ID Facciуn]"); return 1; } else if(strcmp(asignar, "faccion", true) == 0) { if(Info[playerid][pAdminZC] > 1337) { if(!sscanf(params, "ui", lookupid, factionid)) { new ftext[30]; if(params[1] < 0 || params[1] > MAX_FACTION) return SendClientMessageEx(playerid, COLOR_GREY, "ID facciуn incorrecto."); if(!IsPlayerConnected(params[0])) return SendClientMessageEx(playerid, COLOR_GREY, "Jugado desconectado."); switch(params[1]) { case 0: {Info[params[0]][pRank] = 0; ftext = "Ninguna"; } case 1: {Info[params[0]][pRank] = 6; ftext = "San Andreas Police Department"; } case 2: {Info[params[0]][pRank] = 6; ftext = "FBI"; } case 3: {Info[params[0]][pRank] = 6; ftext = "San Andreas Ejйrcito Militar"; } case 4: {Info[params[0]][pRank] = 6; ftext = "San Andreas Medical Deparment"; } case 5: {Info[params[0]][pRank] = 6; ftext = "SA News"; } case 6: {Info[params[0]][pRank] = 6; ftext = "Taller de mecбnicos LS"; } case 7: {Info[params[0]][pRank] = 6; ftext = "Gobierno"; } case 8: {Info[params[0]][pRank] = 6; ftext = "Hitman"; } case 9: {Info[params[0]][pRank] = 6; ftext = "Sistema Judicial"; } } new string[128]; pTazer[params[0]] = 0; Info[params[0]][pLeader] = params[1]; Info[params[0]][pMember] = params[1]; format(string, sizeof(string), "* El administrador %s te asignу el lнder de la facciуn %s.", GetPlayerNameEx(playerid), ftext); SendClientMessageEx(params[0], 0x6ADFFFFF, string); format(string, sizeof(string), "Administraciуn: %s asignу lнder de la facciуn %s a %s.", GetPlayerNameEx(playerid), ftext, GetPlayerNameEx(params[0])); ABroadCast(COLOR_WHITE, string, 3); } else SendClientMessageEx(playerid, COLOR_GRAD2, "USA: /asignar faccion [ID Jugadir] [ID Facciуn]"); } else SendClientMessageEx(playerid, COLOR_WHITE, "Informaciуn: No puedes utilizar йste comando."); return 1; } return 1; }
zcmd(asignar, playerid, params[])
{
new string[128], suffix[10], lookupid, factionid;
if(sscanf(params, "s[10]ii", suffix, lookupid, factionid)) return SendClientMessage(playerid, COLOR_WHITE, "Info: Uso correcto: /Asignar faccion [ID Jugador] [ID Facciуn]");
if(strcmp(suffix, "faccion", true) == 0)
{
if(Info[playerid][pAdminZC] > 1337)
{
new ftext[30];
if(factionid < 0 || factionid > MAX_FACTION) return SendClientMessageEx(playerid, COLOR_GREY, "ID facciуn incorrecto.");
if(!IsPlayerConnected(lookupid)) return SendClientMessageEx(playerid, COLOR_GREY, "Jugado desconectado.");
switch(factionid)
{
case 0: {Info[lookupid][pRank] = 0; ftext = "Ninguna"; }
case 1: {Info[lookupid][pRank] = 6; ftext = "San Andreas Police Department"; }
case 2: {Info[lookupid][pRank] = 6; ftext = "FBI"; }
case 3: {Info[lookupid][pRank] = 6; ftext = "San Andreas Ejйrcito Militar"; }
case 4: {Info[lookupid][pRank] = 6; ftext = "San Andreas Medical Deparment"; }
case 5: {Info[lookupid][pRank] = 6; ftext = "SA News"; }
case 6: {Info[lookupid][pRank] = 6; ftext = "Taller de mecбnicos LS"; }
case 7: {Info[lookupid][pRank] = 6; ftext = "Gobierno"; }
case 8: {Info[lookupid][pRank] = 6; ftext = "Hitman"; }
case 9: {Info[lookupid][pRank] = 6; ftext = "Sistema Judicial"; }
}
pTazer[lookupid] = 0;
Info[lookupid][pLeader] = factionid;
Info[lookupid][pMember] = factionid;
format(string, sizeof(string), "* El administrador %s te asignу el lнder de la facciуn %s.", GetPlayerNameEx(playerid), ftext);
SendClientMessageEx(lookupid, 0x6ADFFFFF, string);
format(string, sizeof(string), "Administraciуn: %s asignу lнder de la facciуn %s a %s.", GetPlayerNameEx(playerid), ftext, GetPlayerNameEx(lookupid));
ABroadCast(COLOR_WHITE, string, 3);
}
else return SendClientMessageEx(playerid, COLOR_WHITE, "Informaciуn: No puedes utilizar йste comando.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "Info: Uso correcto: /Asignar faccion [ID Jugador] [ID Facciуn]");
return 1;
}