[Ajuda] Fazer mensagem aparecer somente uma vez!
#1

Alguйm pode me ajudar a deixar isto aparecer somente uma vez !

pawn Код:
if(IsPlayerInAnyVehicle(i)){
new string3[256];
format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
GameTextForPlayer(i, string3, 6000, 1);
}
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){
   if(IsPlayerInAnyVehicle(i)){
   new string3[256];
   format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
   GameTextForPlayer(i, string3, 6000, 1); }
   return 1;
}
Reply
#3

Mas "if(IsPlayerInAnyVehicle(i)){" nгo й pra saber se ele ta dentro do veiculo, e porque estб em OnPlayerEnterVehicle ?
Reply
#4

Use uma variavel.
Reply
#5

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){
   new string3[256];
   format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
   GameTextForPlayer(i, string3, 6000, 1);
   return 1;
}
Reply
#6

#tonisantolia olha como eu deixei, mas quando eu entro no veiculo nгo aparece o nome dele.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);

    if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5)
    {
        if(function218(vehicleid))
        {
            AddVehicleComponent(vehicleid, 1010);
        }
    }

    new string3[256];
    format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    GameTextForPlayer(playerid, string3, 6000, 1);
   
    if(InCall[playerid]==1) return SendClientMessage(playerid,Vermelho,"[ERRO] Й proibido dirigir e falar no telefone.");
    return 1;
}

O ele ali

pawn Код:
new string3[256];
    format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    GameTextForPlayer(playerid, string3, 6000, 1);
Reply
#7

pawn Код:
new bool:Mostrou_Nome[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
    Mostrou_Nome[playerid] = false;
    return true;
}

public OnPlayerUpdate(playerid) {
    if(IsPlayerInAnyVehicle(playerid)) {
        if(!Mostrou_Nome[playerid]) {
            new string3[256];
            format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            GameTextForPlayer(playerid, string3, 6000, 1);
            Mostrou_Nome[playerid] = true;
        }
    }
    else if(!IsPlayerInAnyVehicle(playerid)) {
        if(Mostrou_Nome[playerid])
            return Mostrou_Nome[playerid] = false;
    }
    return true;
}
Reply
#8

Nгo foi !
Reply
#9

O Problema й no seu gamemode..

Aqui funciona normalmente!

Script utilizado para testes:
pawn Код:
#include a_samp

new VehicleNames[][] =
{
  "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster",
  "Stretch", "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer",
  "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach",
  "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow",
  "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair",
  "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic",
  "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton",
  "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher",
  "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick",
  "Boxvillde", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher",
  "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt", "Tanker", "Roadtrain",
  "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck",
  "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan",
  "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder",
  "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster", "Monster",
  "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30",
  "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car", "Police Car", "Police Car",
  "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs",
  "Boxville", "Tiller", "Utility Trailer"
};

main(){}

new bool:Mostrou_Nome[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
    Mostrou_Nome[playerid] = false;
    return true;
}

public OnPlayerCommandText(playerid, cmdtext[]) {
    if(!strcmp(cmdtext, "/nrg", true)) {
        new Float:a[3];
        GetPlayerPos(playerid, a[0], a[1], a[2]);
        CreateVehicle(522,a[0], a[1], a[2], 0.0, -1, -1, -1);
        return true;
    }
    return false;
}

public OnPlayerUpdate(playerid) {
    if(IsPlayerInAnyVehicle(playerid)) {
        if(!Mostrou_Nome[playerid]) {
            new string3[256];
            format(string3, sizeof(string3), "~g~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            GameTextForPlayer(playerid, string3, 6000, 1);
            Mostrou_Nome[playerid] = true;
        }
    }
    else if(!IsPlayerInAnyVehicle(playerid)) {
        if(Mostrou_Nome[playerid])
            return Mostrou_Nome[playerid] = false;
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)