Detectar nombre
#1

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.
Reply
#2

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
Reply
#3

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?
Reply
#4

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
Reply
#5

Spanish please...
Reply
#6

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.
Reply
#7

Gracias
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)