when NPC join Stat for player is not working?
#1

hi im having an problem with NPC i created some NPC's
but im done with that
later in the week i was working on a textdraw for kills deaths score & rank
its working but when i let join The NPC's to the game the stats of the player will reset
it will be showing the default of it not the stats of the player..
and when a player joins on LAN the same thing happens,
shall i need to change NPC of what i dont know
sry for englisch im from dutch

ty
Reply
#2

TOP under #define <a_samp>
Quote:

new Text:Textdraw0;////////////////////
new Text:Textdraw1;////////////////////
new Text:Textdraw3[MAX_PLAYERS];////////////////////
new Text:Textdraw4[MAX_PLAYERS];////////////////////
new Text:Textdraw5[MAX_PLAYERS];////////////////////
new Text:Textdraw6;
new Text:Textdraw7;
new Text:Textdraw8;
new Text:Textdraw9;
new Text:Textdraw10;

public OnPlayerConnect(playerid)
Quote:

SetTimer("CheckLoggedInAs", 1500, 0);///////////////
SetTimer("CheckLoggedInKillDeaths", 1500, 0);///////////////
SetTimer("OnPlayerUpdateRank",1500, 0);
// Create the textdraws:
Textdraw0 = TextDrawCreate(2.000000, 434.000000, "SCORE: KILLS: DEATHS: RANK:");
TextDrawBackgroundColor(Textdraw0, -1);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.300000);
TextDrawColor(Textdraw0, 255);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 255);
TextDrawTextSize(Textdraw0, 640.000000, 0.000000);

Textdraw1 = TextDrawCreate(1.000000, 432.000000, "||||||||||||||||||||||||||||||||||||||||||||||||| ||||||||||||||||||||||||||");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.500000, -1.600000);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);

Textdraw3[playerid] = TextDrawCreate(70.000000, 434.000000, "10000");
TextDrawBackgroundColor(Textdraw3[playerid], 255);
TextDrawFont(Textdraw3[playerid], 1);
TextDrawLetterSize(Textdraw3[playerid], 0.500000, 1.400000);
TextDrawColor(Textdraw3[playerid], -16776961);
TextDrawSetOutline(Textdraw3[playerid], 1);
TextDrawSetProportional(Textdraw3[playerid], 1);

Textdraw4[playerid] = TextDrawCreate(208.000000, 434.000000, "0");
TextDrawBackgroundColor(Textdraw4[playerid], 255);
TextDrawFont(Textdraw4[playerid], 1);
TextDrawLetterSize(Textdraw4[playerid], 0.500000, 1.400000);
TextDrawColor(Textdraw4[playerid], -16776961);
TextDrawSetOutline(Textdraw4[playerid], 1);
TextDrawSetProportional(Textdraw4[playerid], 1);

Textdraw5[playerid] = TextDrawCreate(365.000000, 434.000000, "0");
TextDrawBackgroundColor(Textdraw5[playerid], 255);
TextDrawFont(Textdraw5[playerid], 1);
TextDrawLetterSize(Textdraw5[playerid], 0.500000, 1.400000);
TextDrawColor(Textdraw5[playerid], -16776961);
TextDrawSetOutline(Textdraw5[playerid], 1);
TextDrawSetProportional(Textdraw5[playerid], 1);

TextDrawShowForPlayer(playerid, Textdraw0);////////////////
TextDrawShowForPlayer(playerid, Textdraw1);////////////////
TextDrawShowForPlayer(playerid, Textdraw3[playerid]);////////////////
TextDrawShowForPlayer(playerid, Textdraw4[playerid]);////////////////
TextDrawShowForPlayer(playerid, Textdraw5[playerid]);////////////////

//================================== R A N K S =================================
Textdraw6 = TextDrawCreate(520.000000, 434.000000, "Beginner");
TextDrawBackgroundColor(Textdraw6, 255);
TextDrawFont(Textdraw6, 1);
TextDrawLetterSize(Textdraw6, 0.500000, 1.399999);
TextDrawColor(Textdraw6, -16776961);
TextDrawSetOutline(Textdraw6, 1);
TextDrawSetProportional(Textdraw6, 1);

Textdraw7 = TextDrawCreate(520.000000, 434.000000, "GoodPlayer");
TextDrawBackgroundColor(Textdraw7, 255);
TextDrawFont(Textdraw7, 1);
TextDrawLetterSize(Textdraw7, 0.500000, 1.399999);
TextDrawColor(Textdraw7, -16776961);
TextDrawSetOutline(Textdraw7, 1);
TextDrawSetProportional(Textdraw7, 1);

Textdraw8 = TextDrawCreate(511.000000, 434.000000, "Ice Cold Killer");
TextDrawBackgroundColor(Textdraw8, 255);
TextDrawFont(Textdraw8, 1);
TextDrawLetterSize(Textdraw8, 0.500000, 1.399999);
TextDrawColor(Textdraw8, -16776961);
TextDrawSetOutline(Textdraw8, 1);
TextDrawSetProportional(Textdraw8, 1);

Textdraw9 = TextDrawCreate(520.000000, 434.000000, "Pro Shooter");
TextDrawBackgroundColor(Textdraw9, 255);
TextDrawFont(Textdraw9, 1);
TextDrawLetterSize(Textdraw9, 0.500000, 1.399999);
TextDrawColor(Textdraw9, -16776961);
TextDrawSetOutline(Textdraw9, 1);
TextDrawSetProportional(Textdraw9, 1);

Textdraw10 = TextDrawCreate(520.000000, 434.000000, "God Of War");
TextDrawBackgroundColor(Textdraw10, 255);
TextDrawFont(Textdraw10, 1);
TextDrawLetterSize(Textdraw10, 0.500000, 1.400000);
TextDrawColor(Textdraw10, -16776961);
TextDrawSetOutline(Textdraw10, 1);
TextDrawSetProportional(Textdraw10, 1);
//================================================== ============================

public OnPlayerDisconnect(playerid, reason)
Quote:

TextDrawDestroy(Textdraw0);///////////////
TextDrawDestroy(Textdraw1);///////////////
TextDrawDestroy(Textdraw3[playerid]);///////////////
TextDrawDestroy(Textdraw4[playerid]);///////////////
TextDrawDestroy(Textdraw5[playerid]);///////////////

Timers @ the bottom
Quote:

forward CheckLoggedInAs(playerid);////////////////////
public CheckLoggedInAs(playerid)////////////////////
{
new string[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "%i",GetPlayerScore(playerid), name);
TextDrawSetString(Text:Textdraw3[playerid], string);
return 1;
}

forward CheckLoggedInKillDeaths(playerid, killerid);////////////////////
public CheckLoggedInKillDeaths(playerid, killerid)////////////////////
{
new string1[128],string2[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string1,sizeof(string1),"%i",AccInfo[killerid][Kills], name);
format(string2,sizeof(string2),"%i",AccInfo[playerid][Deaths], name);
TextDrawSetString(Textdraw4[playerid],string1);
TextDrawSetString(Textdraw5[playerid],string2);
return 1;
}

forward OnPlayerUpdateRank(playerid);
public OnPlayerUpdateRank(playerid)
{
if(GetPlayerScore(playerid) >= 0)
{
TextDrawShowForPlayer(playerid, Textdraw6);
}

if(GetPlayerScore(playerid) >= 20)
{
TextDrawHideForPlayer(playerid, Textdraw6);
TextDrawShowForPlayer(playerid, Textdraw7);
}

if(GetPlayerScore(playerid) >= 30)
{
TextDrawHideForPlayer(playerid, Textdraw7);
TextDrawShowForPlayer(playerid, Textdraw;
}

if(GetPlayerScore(playerid) >= 40)
{
TextDrawHideForPlayer(playerid, Textdraw;
TextDrawShowForPlayer(playerid, Textdraw9);
}

if(GetPlayerScore(playerid) >= 50)
{
TextDrawHideForPlayer(playerid, Textdraw9);
TextDrawShowForPlayer(playerid, Textdraw10);
}

if(GetPlayerScore(playerid) >= 60)
{
TextDrawHideForPlayer(playerid, Textdraw10);
}
return 1;
}

------------------------------------------------------------
here are the NPC i have on the server

Top Under #define <a_samp>
Quote:

new NPCVehicle1;
new NPCVehicle2;
new NPCVehicle3;
new NPCVehicle4;
new NPCVehicle5;
new NPCVehicle6;

public OnFilterScriptInit()
Quote:

//NPC
ConnectNPC("mynpc1","mynpc1");
NPCVehicle1 = CreateVehicle(470, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("mynpc2","mynpc2");
NPCVehicle2 = CreateVehicle(470, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("mynpc3","mynpc3");
NPCVehicle3 = CreateVehicle(470, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("mynpc4","mynpc4");
NPCVehicle4 = CreateVehicle(470, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("mynpc5","mynpc5");
NPCVehicle5 = CreateVehicle(470, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("mynpc6","mynpc6");
NPCVehicle6 = CreateVehicle(425, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

public OnPlayerSpawn(playerid)
Quote:

//NPC
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "mynpc1", true))
{
PutPlayerInVehicle(playerid, NPCVehicle1, 0);
SetPlayerColor(playerid,COLOR_GREEN);
}
else if(!strcmp(npcname, "mynpc2", true))
{
PutPlayerInVehicle(playerid, NPCVehicle2, 0);
SetPlayerColor(playerid,COLOR_ORANGE);
}
else if(!strcmp(npcname, "mynpc3", true))
{
PutPlayerInVehicle(playerid, NPCVehicle3, 0);
SetPlayerColor(playerid,COLOR_BLUE);
}
else if(!strcmp(npcname, "mynpc4", true))
{
PutPlayerInVehicle(playerid, NPCVehicle4, 0);
SetPlayerColor(playerid,COLOR_PURPLE);
}
else if(!strcmp(npcname, "mynpc5", true))
{
PutPlayerInVehicle(playerid, NPCVehicle5, 0);
SetPlayerColor(playerid,COLOR_RED);
}
else if(!strcmp(npcname, "mynpc6", true))
{
PutPlayerInVehicle(playerid, NPCVehicle6, 0);
SetPlayerColor(playerid,COLOR_GREY);
}
return 1;
}

im saving the stats with the filterscript LuxAdmin Credits to him or her sry if im wrong
im having the NPC's in another filterscript and my textdraw in the other script named by Luxadmin
but when i input the filterscript with the NPC's it will show the default textdraw
but when i put out the NPC script, all textdraws working fine

i have the same problem when people connects on LAN or Internet
and the NPC IP = default 127.0.0.1
maybe im wrong with the textdraw but i need this realy hard

sorry for my bad english and i hope someone respond on this
Reply
#3

Use [pawn ] [/pawn ] plz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)