SA-MP Forums Archive
[Ajuda] Ajuda meu GM, so tem um warning - 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] Ajuda meu GM, so tem um warning (/showthread.php?tid=387915)



Ajuda meu GM, so tem um warning - Wanderson_SAMP - 26.10.2012

esse eo Warning ~~>: warning 219: local variable "string" shadows a variable at a preceding level


a linha e essa aqui ~~>: new name[MAX_PLAYER_NAME],string[100];



aqui e todo o comando:~~>
if(strcmp("/bdd", cmdtext, true, 10) == 0)
{
ResetPlayerWeapons(playerid);
new name[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[Teletransporte] %s foi para o Bairro do Death Match(DM) (/bdd)", name );
SendClientMessageToAll(COLOR_GRAD1, string);

SetPlayerPos(playerid,1554.7645,-1246.8375,279.3455);
SetPlayerInterior(playerid,0);
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
SendClientMessage(playerid,COLOR_YELLOW,"Bem-Vindo ao Bairro do Death Match(DM)! (by Wanderson)");

return 1;
}[/FONT]


Re: Ajuda meu GM, so tem um warning - Ouro - 26.10.2012

pawn Код:
if(strcmp("/bdd", cmdtext, true, 10) == 0)
{
ResetPlayerWeapons(playerid);
new name[MAX_PLAYER_NAME],string12[100];
GetPlayerName(playerid, name, sizeof(name));
format(string12, sizeof(string12), "[Teletransporte] %s foi para o Bairro do Death Match(DM) (/bdd)", name );
SendClientMessageToAll(COLOR_GRAD1, string12);

SetPlayerPos(playerid,1554.7645,-1246.8375,279.3455);
SetPlayerInterior(playerid,0);
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
SendClientMessage(playerid,COLOR_YELLOW,"Bem-Vindo ao Bairro do Death Match(DM)! (by Wanderson)");

return 1;
}



Re: Ajuda meu GM, so tem um warning - Q.I - 26.10.2012

Quote:
Originally Posted by Ouro
Посмотреть сообщение
pawn Код:
if(strcmp("/bdd", cmdtext, true, 10) == 0)
{
ResetPlayerWeapons(playerid);
new name[MAX_PLAYER_NAME],string12[100];
GetPlayerName(playerid, name, sizeof(name));
format(string12, sizeof(string12), "[Teletransporte] %s foi para o Bairro do Death Match(DM) (/bdd)", name );
SendClientMessageToAll(COLOR_GRAD1, string12);

SetPlayerPos(playerid,1554.7645,-1246.8375,279.3455);
SetPlayerInterior(playerid,0);
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
SendClientMessage(playerid,COLOR_YELLOW,"Bem-Vindo ao Bairro do Death Match(DM)! (by Wanderson)");

return 1;
}
PHP код:

if(strcmp("/bdd"cmdtexttrue4) == 0// 10 e igual o numero de caracteres entre "" no caso ae so tem 4 caracteres contando com a / puxa vida sera qe ninguem sabe disso ?
{
    
ResetPlayerWeapons(playerid);
    new 
name[MAX_PLAYER_NAME],string12[100];
    
GetPlayerName(playeridnamesizeof(name));
    
format(string12sizeof(string12), "[Teletransporte] %s foi para o Bairro do Death Match(DM) (/bdd)"name );
    
SendClientMessageToAll(COLOR_GRAD1string12);
    
SetPlayerPos(playerid,1554.7645,-1246.8375,279.3455);
    
SetPlayerInterior(playerid,0);
    
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
    
SendClientMessage(playerid,COLOR_YELLOW,"Bem-Vindo ao Bairro do Death Match(DM)! (by Wanderson)");
    return 
1;
}
/*esse warning e causado por conflito de variaveis assim trocando o nome de uma resolve!
return true = return 1
return false = return 0
eu gosto de citar isso acima por que antigamente eu me confundia muito com isso!
*/ 



Re: Ajuda meu GM, so tem um warning - Bruno Bastos - 26.10.2012

if(strcmp("/bdd", cmdtext, true, 4) == 0)
{
ResetPlayerWeapons(playerid);
new name[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[Teletransporte] %s foi para o Bairro do Death Match(DM) (/bdd)", name );
SendClientMessageToAll(0x00FF00AA, string);
SetPlayerPos(playerid,1554.7645,-1246.8375,279.3455);
SetPlayerInterior(playerid,0);
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
SendClientMessage(playerid,0x00FF00AA,"Bem-Vindo ao Bairro do Death Match(DM)! (by Wanderson)");
return 1;
}

Aqui funcionou, tente isso aн.

OBS: Organiza certinho para nгo dar loose indentation.


Re: Ajuda meu GM, so tem um warning - Wanderson_SAMP - 26.10.2012

Mano vlw msm, vc e um bom scripter


eu arrumei so isso
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
pq o seu deu um erro aqui, mais vlw brigado


Re: Ajuda meu GM, so tem um warning - Wanderson_SAMP - 26.10.2012

e esse aqui, consegui com a ajuda de vcs


if(strcmp("/bdd", cmdtext, true, 10) == 0)
{
ResetPlayerWeapons(playerid);
new name[MAX_PLAYER_NAME],string12[100];
GetPlayerName(playerid, name, sizeof(name));
format(string12, sizeof(string12), "[Teletransporte] %s foi para o Bairro do Death Match(DM) (/bdd)", name );
SendClientMessageToAll(COLOR_GRAD1, string12);

SetPlayerPos(playerid,1554.7645,-1246.8375,279.3455);
SetPlayerInterior(playerid,0);
ResetPlayerWeapons(playerid),GivePlayerWeapon(play erid,24,999),GivePlayerWeapon(playerid,31,999),Set PlayerHealth(playerid,100),SetPlayerArmour(playeri d,100);
SendClientMessage(playerid,COLOR_YELLOW,"Bem-Vindo ao Bairro do Death Match(DM)! (by Wanderson)");

return 1;
}


Re: Ajuda meu GM, so tem um warning - Bruno Bastos - 26.10.2012

if(strcmp("/bdd", cmdtext, true, 10) == 0)

entre " " sгo 4 caracteres e nгo 10 como citado acima. Isso pode prejudicar em algo...


Re: Ajuda meu GM, so tem um warning - Q.I - 26.10.2012

Quote:
Originally Posted by Bruno Bastos
Посмотреть сообщение
if(strcmp("/bdd", cmdtext, true, 10) == 0)

entre " " sгo 4 caracteres e nгo 10 como citado acima. Isso pode prejudicar em algo...
voce so sabe disso por que leu o que eu postei lah em cima


Re: Ajuda meu GM, so tem um warning - Wanderson_SAMP - 26.10.2012

como eu coloco esse comando sу para adm 1342?


Re: Ajuda meu GM, so tem um warning - TreePuncher - 26.10.2012

Quote:
Originally Posted by Bruno Bastos
Посмотреть сообщение
if(strcmp("/bdd", cmdtext, true, 10) == 0)

entre " " sгo 4 caracteres e nгo 10 como citado acima. Isso pode prejudicar em algo...
Esse jeito й ruim para iniciantes, ja que podem por numeros "demasiados" na hora da comparaзгo.
Se for pra por numeros assim, faзa como eu
PHP код:
if(!strcmp("/bdd"cmdtexttrue)) 
Й mais fбзil do que ficar contando letras xD