Comandos -
Ts3 - 09.08.2014
Fiz um comando para o chat de uma profissгo, como vou saber que sу estб enviando para quem quem estб com a mesma profissгo? por isso nгo sei se estб certo.. o comando estб funcionando.
pawn Код:
command(cp, playerid, params [])
{
new string[200];
if(isnull(params)) return SendClientMessage(playerid, Vermelho, "[ x ] Uso correto: /cp [Texto]");
if(Profissao[playerid] != Profissao[playerid])
format(string, sizeof(string), "( CP ) '%s' diz: %s", Nome(playerid), params);
SendClientMessage(playerid, Chat, string);
return 1;
}
Outra ajuda e para criar veнculos para uma prof, criei um cуdigo mas quando eu entro em qualquer carro sou removido..
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
if(Profissao[playerid] != Profissao[playerid])
SendClientMessage(playerid, Chat, "[ > ] Esse veiculo й reservado para uma profissгo!");
RemovePlayerFromVehicle(playerid);
return 1;
}
Re: Comandos -
zSuYaNw - 09.08.2014
Tens que fazer um loop!!!
pawn Код:
command(cp, playerid, params [])
{
/*/ new string[200];
if(isnull(params)) return SendClientMessage(playerid, Vermelho, "[ x ] Uso correto: /cp [Texto]");
if(Profissao[playerid] != Profissao[playerid])
format(string, sizeof(string), "( CP ) '%s' diz: %s", Nome(playerid), params);
SendClientMessage(playerid, Chat, string); */
if(isnull(params))
return SendClientMessage(playerid, Vermelho, "[ x ] Uso correto: /cp [Texto]");
static
i, x
;
for(i = 0, x = GetMaxPlayers(); i ^ x; ++i){
if(Profissao[i] == Profissao[playerid]){
format(string, sizeof(string), "( CP ) '%s' diz: %s", Nome(playerid), params);
SendClientMessage(i, Chat, string); */
}
}
return 1;
}
Re: Comandos -
Ts3 - 09.08.2014
zSuYaNw nгo funcionou.
#Edit
Fiz desse jeito vai pegar ?
pawn Код:
command(cp, playerid, params [])
{
new string[200];
if(isnull(params)) return SendClientMessage(playerid, Vermelho, "[ x ] Uso correto: /cp [Texto]");
for(new i=0; i < MAX_PLAYERS; i++)
{
if(Profissao[i] == Profissao[playerid])
format(string, sizeof(string), "( CP ) '%s' diz: %s", Nome(playerid), params);
SendClientMessage(i, Chat, string);
}
return 1;
}
Re: Comandos -
zSuYaNw - 10.08.2014
Creio que sim.
pawn Код:
CMD:cp(playerid, params[]){
if(isnull(params)){
return SendClientMessage(playerid, Vermelho, "[ x ] Uso correto: /cp [Texto]");
}
for(new i, e = GetMaxPlayers(); i != e; ++i){
if(Profissao[i] == Profissao[playerid]) {
format(string, sizeof(string), "( CP ) '%s' diz: %s", Nome(playerid), params);
SendClientMessage(i, Chat, string);
}
}
return true;
}
Re: Comandos -
Ts3 - 10.08.2014
Certo estб tudo certo com a primeira ajuda, essa segunda pode me ajudar tambйm?
PS: Esse seu cуdigo do cp estб funcionando..
Cуdigo
pawn Код:
new Carro[8];
public OnFilterScriptInit()
{
Carro[0] = AddStaticVehicle(428,1774.8734,-1702.2725,13.6294,359.9309,0,0);
Carro[1] = AddStaticVehicle(428,1782.8901,-1702.1434,13.6302,0.4223,0,0);
Carro[2] = AddStaticVehicle(428,1807.4386,-1708.0154,13.6709,90.7226,0,0);
Carro[3] = AddStaticVehicle(428,1774.6498,-1690.5526,13.5570,180.3277,0,0);
Carro[4] = AddStaticVehicle(428,1783.2854,-1690.4011,13.5662,179.3017,0,0);
Carro[5] = AddStaticVehicle(428,1793.0089,-1690.3987,13.5979,179.2736,0,0);
Carro[6] = AddStaticVehicle(428,1794.7051,-1701.2280,13.6554,359.6884,0,0);
Carro[7] = AddStaticVehicle(428,1806.7419,-1703.1401,13.6693,90.1741,0,0);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid;
if(oldstate == PLAYER_STATE_DRIVER)
if(GetVehicleModel(vehicleid) == 428)
if(Profissao[playerid] != Profissao[playerid])
SendClientMessage(playerid, Chat, "[ > ] Vocк nгo tem permissгo para usar esse carro");
RemovePlayerFromVehicle(playerid);
return 1;
}
Quando eu entro no carro sou removido sendo que eu estou com a profissгo..
Re: Comandos -
zSuYaNw - 10.08.2014
Dб uma testada aн
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid;
if(oldstate == PLAYER_STATE_DRIVER)
{
if(!(Carro[0] < vehicleid < Carro[7])){
if(Profissao[playerid] != Profissao[playerid]){
SendClientMessage(playerid, Chat, "[ > ] Vocк nгo tem permissгo para usar esse carro");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Re: Comandos -
Ts3 - 11.08.2014
nгo funcionou garfield, a profissгo estб quase pronta a ъnica coisa que falta й isso. =/
Re: Comandos -
ViniBorn - 11.08.2014
Tenta trocar oldstate por newstate
Re: Comandos -
Ts3 - 11.08.2014
Vini agora qualquer pessoa pode usar o carro da profissгo!