SA-MP Forums Archive
Detectar nombre - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Detectar nombre (/showthread.php?tid=521140)



Solucionado - NickoPico - 21.06.2014

Hola, necesito una funcion que detecte el nombre del jugador y lo relacione con algo, en mi caso con el nombre del dueсo de una propiedad, yo tengo la funcion asi.

if(strcmp(PropInfo[propid][PropOwner], pNamer, true)==0)

Pero no e como hacerlo en el caso de que el nombre no sea el del dueсo de la propiedad, seria asi?

if(strcmp(PropInfo[propid][PropOwner], pNamer, false)==0)

Lo hice de esa manera y no me funciona, alguien que tenga una funcion para detectar el nombre porfavor, saludos.


Respuesta: Detectar nombre - OTACON - 21.06.2014

pawn Код:
new name[24];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(PropInfo[playerid][PropOwner], name)){
//DUEСO CORRECTO
}else{
//DUEСO INCORRECTO
}

https://sampwiki.blast.hk/wiki/Strcmp


Respuesta: Detectar nombre - NickoPico - 21.06.2014

Quote:
Originally Posted by OTACON
Посмотреть сообщение
pawn Код:
new name[24];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(PropInfo[playerid][PropOwner], name)){
//DUEСO CORRECTO
}else{
//DUEСO INCORRECTO
}

https://sampwiki.blast.hk/wiki/Strcmp
No que el "!" significa algo que no es?


Respuesta: Detectar nombre - OTACON - 21.06.2014

https://sampwiki.blast.hk/wiki/Strcmp

-1 if string1 comes before string2
1 if string1 comes after string2
0 if the strings are the same (for the matched length).


PD: para facilitarte puedes usar y_stringhash --> https://sampforum.blast.hk/showthread.php?tid=169354


Respuesta: Detectar nombre - NickoPico - 21.06.2014

Spanish please...


Respuesta: Detectar nombre - Swedky - 22.06.2014

strcmp retorna 0 si ambas cadenas son iguales, 1 si no lo son.

En el cуdigo de OTACON, al usar '!' es como declarar que queremos que nuestra comparaciуn retorne 0.


Respuesta: Detectar nombre - NickoPico - 22.06.2014

Gracias