im having an issue with trying to spawn at my deathpoint. it works fine and correctly but its going to id 0s spawn point. how can i fix this to where it to spawn to my own position?
Код:
#include <a_samp>
#define deathpoint1 (324)
//new IsPlayerDead[MAX_PLAYERS];
new MyFirstDead[MAX_PLAYERS];
new Float:xpos1, Float:ypos1, Float:zpos1, Float:Anglepos1;
/*new mycarid;
new Float:vzrot;*/
OnPlayerConnect(playerid)
{
MyFirstDead[playerid]=0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
MyFirstDead[playerid]=1;
GetPlayerPos(playerid,xpos1,ypos1,zpos1);
GetPlayerFacingAngle(playerid, Anglepos1);
/* I dont think you can spawn with a vehicle, unless you do some script where, when you spawn,
the script gives you one.
mycarid=GetPlayerVehicleID(playerid);
GetVehiclePos(playerid,xpos1,ypos1,zpos1);
GetVehicleZAngle(mycarid, vzrot);
*/
return 1;
}
public OnPlayerSpawn(playerid)
{
if(MyFirstDead[playerid]==1)
{
ShowPlayerDialog(playerid, deathpoint1, DIALOG_STYLE_MSGBOX, "Question", "Do you want to Spawn back to where you died?", "yes", "no");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == deathpoint1)
{
if (response == 1)
{
SetPlayerFacingAngle( playerid, Anglepos1);
SetPlayerPos(playerid, xpos1, ypos1, zpos1);
/*SetVehiclePos(mycarid,xpos1,ypos1,zpos1);
SetVehicleZAngle(mycarid, vzrot);
PutPlayerInVehicle(playerid, mycarid, 0); I think you have to create one*/
/*You could do here something like "CreateVehicle(mycarid,xpos1,ypos1,zpos1,blablabla);" but you you would have to destroy that car in some point, otherwise the server would have cars spawned all over the place, if you know what I mean*/
SendClientMessage(playerid, 0xFFFFFFFF, "You have Teleported Where You Died");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You Cancelled");
}
return 1;
}
return 1;
}
I did this right in notepad, I didnt compilated and checked for errors/warnings.
i didnt work when i had the vehicle stuff in there but when i got rid of the vehicle stuff it worked fine where i was teleporting was one of the npc's location id 0
ok here it is: i have timers for npc 4 rc tanks right? what the timers do is creates explosions in front my 4 rc tanks. but the explosions r only creating for the ID 0 which is my barron. any solution?
Код:
#include <a_samp>
#include <a_npc>
#define FILTERSCRIPT
new Barronr1;
new Barronr2;
new Banditr1;
new Banditr2;
new Goblinr1;
new Goblinr2;
new Raiderr1;
new Raiderr2;
new Tankr1;
new Tankr2;
public OnFilterScriptInit(){
print(" _______________________________");
print("| LOADING... |");
print("| RC BOTS |");
print("| By Troy Version 1.00 |");
print("|_______________________________|");
ConnectNPC("Barrond1","Barron1");
ConnectNPC("Barrond2","Barron2");
ConnectNPC("Banditd1","Bandit1");
ConnectNPC("Banditd2","Bandit2");
ConnectNPC("Goblind1","Goblin1");
ConnectNPC("Goblind2","Goblin2");
ConnectNPC("Raiderd1","Raider1");
ConnectNPC("Raiderd2","Raider2");
ConnectNPC("Tankd1","Tank1");
ConnectNPC("Tankd2","Tank2");
Barronr1 = CreateVehicle(464,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Barronr2 = CreateVehicle(464,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Banditr1 = CreateVehicle(564,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Banditr2 = CreateVehicle(564,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Goblinr1 = CreateVehicle(501,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Goblinr2 = CreateVehicle(501,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Raiderr1 = CreateVehicle(465,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Raiderr2 = CreateVehicle(465,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Tankr1 = CreateVehicle(564,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
Tankr2 = CreateVehicle(564,-1004.2155,994.8294,1411.7723,205.4225,1,1,1);
LinkVehicleToInterior(Barronr1, 10);
LinkVehicleToInterior(Barronr2, 10);
LinkVehicleToInterior(Banditr1, 10);
LinkVehicleToInterior(Banditr2, 10);
LinkVehicleToInterior(Goblinr1, 10);
LinkVehicleToInterior(Goblinr2, 10);
LinkVehicleToInterior(Raiderr1, 10);
LinkVehicleToInterior(Raiderr2, 10);
LinkVehicleToInterior(Tankr1, 10);
LinkVehicleToInterior(Tankr2, 10);
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname,"Barrond1",true)) {
PutPlayerInVehicle(playerid, Barronr1, 0);
LinkVehicleToInterior(Barronr1, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
return 1;
}
if(!strcmp(npcname,"Barrond2",true)) {
PutPlayerInVehicle(playerid, Barronr2, 0);
LinkVehicleToInterior(Barronr2, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
return 1;
}
if(!strcmp(npcname,"Banditd1",true)) {
PutPlayerInVehicle(playerid, Banditr1, 0);
SetPlayerColor(playerid,0xFF000050);
LinkVehicleToInterior(Banditr1, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
SetTimer("exploding1",5000,true);
return 1;
}
if(!strcmp(npcname,"Banditd2",true)) {
PutPlayerInVehicle(playerid, Banditr2, 0);
LinkVehicleToInterior(Banditr2, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
SetTimer("exploding2",5000,true);
return 1;
}
if(!strcmp(npcname,"Goblind1",true)) {
PutPlayerInVehicle(playerid, Goblinr1, 0);
LinkVehicleToInterior(Goblinr1, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
return 1;
}
if(!strcmp(npcname,"Goblind2",true)) {
PutPlayerInVehicle(playerid, Goblinr2, 0);
LinkVehicleToInterior(Goblinr2, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
return 1;
}
if(!strcmp(npcname,"Raiderd1",true)) {
PutPlayerInVehicle(playerid, Raiderr1, 0);
LinkVehicleToInterior(Raiderr1, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
return 1;
}
if(!strcmp(npcname,"Raiderd2",true)) {
PutPlayerInVehicle(playerid, Raiderr2, 0);
LinkVehicleToInterior(Raiderr2, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
return 1;
}
if(!strcmp(npcname,"Tankd1",true)) {
PutPlayerInVehicle(playerid, Tankr1, 0);
LinkVehicleToInterior(Tankr1, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
SetTimer("exploding3",5000,true);
return 1;
}
if(!strcmp(npcname,"Tankd2",true)) {
PutPlayerInVehicle(playerid, Tankr2, 0);
LinkVehicleToInterior(Tankr1, 10);
SetPlayerColor(playerid,0xFF000050);
SetPlayerSkin(playerid,287);
SetTimer("exploding4",5000,true);
return 1;
}
return 1;
}
return 1;
}
forward exploding1(playerid);
public exploding1(playerid){
new Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:az;
GetPlayerPos(playerid,x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), az);
x2 = x + (15 * floatsin(-az+5, degrees));
y2 = y + (30 * floatcos(-az+5, degrees));
CreateExplosion(x2,y2,z,3,4.0);
return 1;}
forward exploding2(playerid);
public exploding2(playerid){
new Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:az;
GetPlayerPos(playerid,x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), az);
x2 = x + (15 * floatsin(-az+5, degrees));
y2 = y + (30 * floatcos(-az+5, degrees));
CreateExplosion(x2,y2,z,3,4.0);
return 1;}
forward exploding3(playerid);
public exploding3(playerid){
new Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:az;
GetPlayerPos(playerid,x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), az);
x2 = x + (15 * floatsin(-az+5, degrees));
y2 = y + (30 * floatcos(-az+5, degrees));
CreateExplosion(x2,y2,z,3,4.0);
return 1;}
forward exploding4(playerid);
public exploding4(playerid){
new Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:az;
GetPlayerPos(playerid,x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), az);
x2 = x + (15 * floatsin(-az+5, degrees));
y2 = y + (30 * floatcos(-az+5, degrees));
CreateExplosion(x2,y2,z,3,4.0);
return 1;}
Try to create a single Timer for the all 4 in OnFilterScriptInit our SetTimerEx in each one.