[Ajuda] If com GetPlayer Name - 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: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] If com GetPlayer Name (
/showthread.php?tid=437530)
If com GetPlayer Name -
iCracker - 16.05.2013
Preciso checkar se nome do player que entro no carro e o mesmo que fica salvo na pasta carros do meu sistema de veiculos so que esta salvando o nome em numero toda vez que eu comprava um carro salva o numero 93 no lugar do nome eu declarei a variavel quem poder ajudar ficarei muito grato desde ja Obrigado a todos.
PHP код:
new namec[MAX_PLAYERS][MAX_PLAYER_NAME];
GetPlayerName(playerid, namecc, sizeof(namecc));
DOF2_SetInt(file, "Dono", namec[playerid]); // aki a linha que salva o nome do player
No caso o if da OnPlayerStateChange ficando assim \/
PHP код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
if(namec[playerid] == pname[playerid])
{
SendClientMessage(playerid, 0x00CC00FF, "[ > ]Bem Vindo(a) ao seu veiculo.");
}
else
{
SendClientMessage(playerid, 0x00CC00FF, "[ > ]Este veiculo nao e seu..");
RemovePlayerFromVehicle(playerid);
}
Re: If com GetPlayer Name -
Gii - 16.05.2013
https://sampwiki.blast.hk/wiki/Strcmp
Re: If com GetPlayer Name -
iCracker - 16.05.2013
nao entendi nada tem um monte de funзoes aew e talz oque eu faзo com elas
?
Re: If com GetPlayer Name -
Gii - 16.05.2013
pawn Код:
new namec[MAX_PLAYER_NAME];
GetPlayerName(playerid, namecc, MAX_PLAYER_NAME);
DOF2_SetString(file, "Dono", namec); // aki a linha que salva o nome do player
OnPlayerStateChange
pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
if (strcmp(DOF2_GetString(file, "Dono"), pname) == 0) {
SendClientMessage(playerid, 0x00CC00FF, "[ > ]Bem Vindo(a) ao seu veiculo.");
}
else {
SendClientMessage(playerid, 0x00CC00FF, "[ > ]Este veiculo nao e seu..");
RemovePlayerFromVehicle(playerid);
}
OBS: Nгo sei ai, mas no caso aqui nгo defini "file", entгo caso nгo tenha feito isso faзa.