[PEDIDO] Skin retomada ao spawnar! -
[GDS]Null - 13.07.2011
Olб gaaleraa.. Eu preciso de uma ajuda, eu tenho um sistema de skin bem simples mas que deu muito trabalho para fazer.. Como eu nгo gosto daquele sistema starok se й assim que se fala, entгo eu fiz um comando para cada uma skin.
Vou postar ele aqui...
Comando de skin do meu server:
Код:
if (strcmp("/ms 0", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 0);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 1", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 1);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 2", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 2);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 3", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 3);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 4", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 4);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 5", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 5);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 6", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 6);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 7", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 7);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 8", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 8);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 9", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 9);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 9", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 9);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 10", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 10);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 11", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 11);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 12", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 12);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
if (strcmp("/ms 13", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 13);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
return 1;
}
E й assim atй o skin 299..
Mais estou tendo um seguinte problema..
o player usa o /ms e muda sua skin, quando ele reloga sem morrer continua a skin, mas quando ele morre
volta a skin que ele escolheu quando logou pela 1° vez no server, quando se registrou...
Eu queria que quando ele o player morrer, tenha alguma coisa no OnPlayerDeath como GetPlayerSkin usando o starok ou sei lб qualquer sistema... e no OnPLayerSpawn um SetPlayerSkin, da skin que pegou quando ele spawna ou no comando..
Podem me ajudar?
Obrigado des de jб, abraзss!
------------
Algumas pessoas nao entenderгo entгo...
Ok, e o seguinte, quando o player re-spawna ele volta a skin que escolheu quando se registrou.. eu queria alguma coisa que fizesse para pegar a skin dele e quando re-spawnar voltar a skin escolhida pelo comando /ms
Re: [PEDIDO] Skin retomada ao spawnar! -
[AF]Junior - 13.07.2011
Nгo entendi bolhufas... Explica melhor, aн й tenso.
AW: [PEDIDO] Skin retomada ao spawnar! -
[GDS]Null - 13.07.2011
Ok, e o seguinte, quando o player re-spawna ele volta a skin que escolheu quando se registrou.. eu queria alguma coisa que fizesse para pegar a skin dele e quando re-spawnar voltar a skin escolhida pelo comando /ms
Re: [PEDIDO] Skin retomada ao spawnar! -
arakuta - 13.07.2011
Nгo testei, mas tenta isso:
pawn Код:
if (strcmp("/ms 0", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 0);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
SetPVarInt(playerid,"Skin",0); // Esse 0 nгo tem nada a ver com a skin, mas use ele com o mesmo valor da skin para nao se confundir dps...
return 1;
}
if (strcmp("/ms 1", cmdtext, true) == 0)
{
SetPlayerSkin(playerid, 1);
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
SetPVarInt(playerid,"Skin",1); // Esse 1 nгo tem nada a ver com a skin, mas use ele com o mesmo valor da skin para nao se confundir dps...
return 1;
}
E agora em OnPlayerSpawn
pawn Код:
if(GetPVarInt(playerid,"Skin") == 0) // Lembra o 0 que te falei? Ele й sу referencia, se fosse 1 (desde que 1 no cmd tambйm) e a skin 0, daria no mesmo
{
SetPlayerSkin(playerid, 0); // retornara a skin 0,
}
if(GetPVarInt(playerid,"Skin") == 1)
{
SetPlayerSkin(playerid, 1);
}
Eu sou novato em pawn, mas qualquer coisa posta ae.
Re: [PEDIDO] Skin retomada ao spawnar! -
Shadoww5 - 13.07.2011
Deixa de ser teimoso ! rumm
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ms", true) == 0)
{
new skin[256];
skin = strtok(cmdtext, idx);
if(!strlen(skin)) return SendClientMessage(playerid, 0xFF0000FF, "USO: /skin [ID DA SKIN]");
SendClientMessage(playerid, COR_AZUL, "Parabens!, Vocк trocou de skin!");
SetPlayerSkin(playerid, strval(skin));
return 1;
}
return 0;
}
public OnPlayerDeath(playerid, reason)
{
SetPVarInt(playerid, "Skin", GetPlayerSkin(playerid));
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, GetPVarInt(playerid, "Skin"));
DeletePVar(playerid, "Skin");
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Re: [PEDIDO] Skin retomada ao spawnar! -
arakuta - 13.07.2011
Acabei de testar e meu cуdigo e funcional... Porйm o do shadoww5 estб mais otimizado...
AW: [PEDIDO] Skin retomada ao spawnar! -
[GDS]Null - 13.07.2011
Olб denovo, Eu testei os 2 o seu arakuta nao funcionou no meu nao, hora que respawn, respawn com a skin 0...
E a do shadown da muitos erros..
Re: [PEDIDO] Skin retomada ao spawnar! -
arakuta - 13.07.2011
Faзa assim Null, coloca os meus codigos de onplayerspawn por ultimo, assim:
pawn Код:
public OnPlayerSpawn(playerid)
{
// SEUS CODIGOS
// SEUS CODIGOS
if(GetPVarInt(playerid,"Skin") == 0) // Lembra o 0 que te falei? Ele й sу referencia, se fosse 1 (desde que 1 no cmd tambйm) e a skin 0, daria no mesmo
{
SetPlayerSkin(playerid, 0); // retornara a skin 0,
}
if(GetPVarInt(playerid,"Skin") == 1)
{
SetPlayerSkin(playerid, 1);
}
return 1;
}
Entretando, passe seu onplayedeath para analisar-mos
AW: [PEDIDO] Skin retomada ao spawnar! -
[GDS]Null - 13.07.2011
Olб eu denovo respondendo o arakuta...
Cara fiz oque voce falou no spawn.. entretanto colocarei o Death aki..
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
Combate[playerid] = 0;
Combate[playerid] = 0;
GameTextForPlayer(playerid,"~r~Morto!",5000,5);
GivePlayerMoney(playerid, -1000);
SendClientMessage(playerid, COR_AZUL, " Vocк foi para o Hospital e perdeu R$ 1.000.");
SetPlayerScore(killerid,GetPlayerScore(killerid)+3);
SetPlayerWantedLevel(killerid,0);
GivePlayerMoney(killerid, 2000);
SendClientMessage(killerid,COR_AZUL,"Vocк Ganhou $ 2.000 e 3 de Score Por matar Um Player!");
return 1;
}
Re: [PEDIDO] Skin retomada ao spawnar! -
arakuta - 13.07.2011
Isso й superfluo ( O Jogador Mata alguem e nгo ganha wanted level, mas a funзгo ta ali...)
pawn Код:
SetPlayerWantedLevel(killerid,0);
PS: Perdгo, nгo era onplayerdeath, era onplayerspawn
EDIT: Esperei vinte minutos pra voce postar o onplayerspawn e nгo postou, entгo vou dormir. amnhг de manhг eu tento lhe ajudar novamente. Poste o OnPlayerSpawn por favor. Verifique linhas como SetPlayerSkin nele.