Possible to disable ID 0? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Possible to disable ID 0? (
/showthread.php?tid=338998)
Possible to disable ID 0? -
dholmes7512 - 01.05.2012
Hello again, I've encountered another issue. All my commands require RP names, without the '_'. So I created a custom GetPlayerNameEx(playerid), and a GetOtherPlayerNameEx(). But whenever it does a global text, whenever it is ID 0 who does it, GetOtherPlayerNameEx() shows the players name rather than the targets. But for ID 1 + they work.
So I was wondering, if their was a possible way of disabling ID 0? It would be much appreciated.
Re: Possible to disable ID 0? -
Landon - 01.05.2012
The only way to do this is by adding a NPC.
Re: Possible to disable ID 0? -
Mean - 01.05.2012
Yes, just connect a bot that always takes ID 0. However, if you do your functions properly, there should be no problems with ID 0. Click
here for a tutorial on how to add NPC's.
Re: Possible to disable ID 0? -
dholmes7512 - 01.05.2012
Well my target code is this:
Код:
stock GetOtherPlayerNameEx()
{
new targetid;
new targetname[MAX_PLAYER_NAME];
GetPlayerName(targetid, targetname,sizeof(targetname));
for(new i;i<strlen(targetname);i++)
{
if(targetname[i] == '_') targetname[i] = ' ';
}
return targetname;
}
Should I alter this or simply add a NPC?
And thanks for the quick replies guys.
Re: Possible to disable ID 0? -
Vince - 01.05.2012
That function makes absolutely no sense. You initialize targetid, but never assign a value to it; it will always be 0. Get rid of that targetid declaration and put it in the function header.
pawn Код:
stock GetOtherPlayerNameEx(targetid)
Re: Possible to disable ID 0? -
dholmes7512 - 01.05.2012
Well, I done that, same error. Only worse, certain commands it shows blank, the rest shows the wrong name.