Little help
#1

hi
hmm
i have a server with a bot that drive a shamal around the san andreas, when he arrives at an airport, the server send a message to all players, example: "The shamal is now on LS airport waiting for passengers", the problem is, he floods the chat every 500 miliseconds, cause i make a timer, how i can make the server send a message for all one more time only?
and, i added the shamal fs to my server, but he dont work, when i press G, nothing happen...
thx and sry for bad english..

the code:
Код:
#pragma tabsize 0
#include <a_samp>
new MyFirstNPCVehicle;
new SultanLSTour;
new tourtxt;
new vshamal;
forward onairport(playerid);
forward anim(playerid);
//-------------------------------------------------

public onairport(playerid)
{

	new playername[64];
	GetPlayerName(playerid,playername,64);
	
	
	if(!strcmp(playername,"shamal",true))
  if(IsPlayerInRangeOfPoint(playerid, 100.0, 1969.8297,-2306.2217,14.7241)) {
  SendClientMessageToAll(0xDEEE20FF, "O shamal estб agora no Aeroporto de LS esperando por passageiros.");
  }
	if(!strcmp(playername,"shamal",true))
  if(IsPlayerInRangeOfPoint(playerid, 100.0, -1540.3843,-210.6422,17.2489)) {
  SendClientMessageToAll(0xDEEE20FF, "O shamal estб agora no Aeroporto de SF esperando por passageiros.");
  }
	if(!strcmp(playername,"shamal",true))
  if(IsPlayerInRangeOfPoint(playerid, 100.0, 1615.1504,1608.8933,11.9160)) {
  SendClientMessageToAll(0xDEEE20FF, "O shamal estб agora no Aeroporto de LV esperando por passageiros.");
  }
	return 1;
}
public OnFilterScriptInit()
{

  SetTimer("anim", 500, 1);
  SetTimer("onairport", 500, 1);
  MyFirstNPCVehicle = AddStaticVehicle(567,1527.6833,-1039.5702,23.3538,70.0264,74,72); // carspawnpoint
  SultanLSTour = AddStaticVehicle(560,1524.0270,-1047.0073,23.5044,249.1542,0,0); //tourls sultan spawn
  vshamal = AddStaticVehicle(519,1468.5172,1284.1729,11.7919,194.1353,1,1);
  tourtxt = Create3DTextLabel("LS Tour", 0xFFFFFFFF, 1524.0270,-1047.0073,23.5044, 50.0, 0);
  Attach3DTextLabelToVehicle(tourtxt, SultanLSTour, 0.0, 0.0, 1.0);
  ConnectNPC("shamal","shamal");
  ConnectNPC("NPC1","mynpc");
  ConnectNPC("NPC2","mynpc2");
  ConnectNPC("Cop","cop");

	return 1;
}

//-------------------------------------------------
public anim(playerid)
{
	new playername[64];
	GetPlayerName(playerid,playername,64);
if(!strcmp(playername, "Cop", true)) {
LoopingAnim(playerid,"Strip","STRIP_C",4.0,1,1,1,1,0);
   }
return 1;
}
new gPlayerUsingLoopingAnim[MAX_PLAYERS];
LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
  gPlayerUsingLoopingAnim[playerid] = 1;
  ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
public OnPlayerRequestClass(playerid, classid)
{
	if(!IsPlayerNPC(playerid)) return 0; 
	
	new playername[64];
	GetPlayerName(playerid,playername,64);
	
 	if(!strcmp(playername,"NPC1",true)) {
  SetSpawnInfo(playerid,69,255,1527.6833,-1039.5702,23.3538,0.0,-1,-1,-1,-1,-1,-1);
	}
 	if(!strcmp(playername,"NPC2",true)) {
  SetSpawnInfo(playerid,69,255,1524.0270,-1047.0073,23.5044,0.0,-1,-1,-1,-1,-1,-1);
	}
 	if(!strcmp(playername,"Cop",true)) {
  SetSpawnInfo(playerid,69,283,1537.3004,-1035.7268,23.8041,0.0,-1,-1,-1,-1,-1,-1);
	}
 	if(!strcmp(playername,"shamal",true)) {
  SetSpawnInfo(playerid,69,255,1473.3497,1267.5237,10.8203,0.0,-1,-1,-1,-1,-1,-1);
	}

	return 0;
}

public OnPlayerSpawn(playerid)
{
	if(!IsPlayerNPC(playerid)) return 1; 

	new playername[64];
	GetPlayerName(playerid,playername,64);

  if(!strcmp(playername, "NPC1", true)) {
    PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0);
    SetPlayerColor(playerid,0xFFFFFFFF);
  }
  if(!strcmp(playername, "NPC2", true)) {
    PutPlayerInVehicle(playerid, SultanLSTour, 0);
    SetPlayerColor(playerid,0xFFFFFFFF);
  }
  if(!strcmp(playername, "cop", true)) {
  SetPlayerColor(playerid,0xFFFFFFFF);
  }
  if(!strcmp(playername, "shamal", true)) {
  PutPlayerInVehicle(playerid, vshamal, 0);
  SetPlayerColor(playerid,0xFFFFFFFF);
  }

	return 1;
}
obs: the "O shamal estб agora no Aeroporto de LS esperando por passageiros." is "the shamal is now on ls airport waiting for passengers" on my language.
obs2: im noob on pawn
thx and sry for bad english................... again
Reply
#2

maybe
pawn Код:
SetTimer("onairport", 500, 0);
Reply
#3

Take a look at the example npcmodes given with the server, You don't need a timer to determine when an NPC has made it to a spot, just use OnRecordingPlaybackEnd()
Reply
#4

yea, but its only one archive .rec, i can make a checkpoint for bot, when he get the checkpoint, start a another .rec? can you help me with this?
another problem is, the server only send messages, if the bot "shamal" enter on server with id 0, wtf? O.o
Reply
#5

lol but the include npcs dont work with inc players, how i make OnRecordingPlaybackEnd() with SendMessageForAll()? i just want to he send a message when the shamal arrives a airport, the npcmodes given with the server dont send a message --'
other problem is, the bot "cop" only ApplyAnimation when he enters on server with id 0, wtf is happening @_@
heeeeellllppppp plz
and thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)