Only taking id0 even if i type id 1 -
MayaEU - 08.07.2016
Hello, when i set gate owner and we are two, or more online
i can only set Id 0 as the owner, even if i type the name of id 2, it just says "id 0 is already the owner
what is wrong?
pawn Код:
if (dialogid == DIALOG_NEWGOWNER)
{
if (response)
{
new ostring[MAX_PLAYER_NAME], astring[128];
strcpy(ostring, gowner[gsaveid[playerid]]);
//new plid;
if (sscanf(inputtext, "u", playerid)) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player ID/Name");
else if (playerid == INVALID_PLAYER_ID) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player");
else
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
if(!strcmp(gowner[gsaveid[playerid]], pname))
{
format(astring, 128, ""COL_WHITE"%s is already the owner of the gate %i", pname, gsaveid[playerid]);
SendClientMessage(playerid, -1, astring);
}
else
{
new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
INI_SetTag(gatefile, "data");
INI_WriteString(gatefile, "owner", pname);
INI_Close(gatefile);
if (!strcmp(ostring, "none")) format(astring, 128, ""COL_GREEN"You have set %s to be the owner of the gate %i.", pname, gsaveid[playerid]);
else format(astring, 128, ""COL_GREEN"%s is no longer the owner of the gate %i. %s is the new owner", ostring, gsaveid[playerid], pname);
SendClientMessage(playerid, -1, astring);
}
}
}
}
Re: Only taking id0 even if i type id 1 -
MayaEU - 08.07.2016
Sorry i have put the wrong code, its the right one now ^^
Re: Only taking id0 even if i type id 1 -
XtremeRz - 08.07.2016
Well, can you say how you fixed it?
Re: Only taking id0 even if i type id 1 -
Stinged - 09.07.2016
Use something other than playerid.
Create a new variable like 'targetid' or something.
Re: Only taking id0 even if i type id 1 -
MayaEU - 09.07.2016
Quote:
Originally Posted by XtremeRz
Well, can you say how you fixed it?
|
I have not fixed it yet 😊
Re: Only taking id0 even if i type id 1 -
MayaEU - 09.07.2016
Anyone?
Re: Only taking id0 even if i type id 1 -
MayaEU - 09.07.2016
I tried to make this but it gives me errors when im compiling
pawn Код:
if (dialogid == DIALOG_NEWGOWNER)
{
if (response)
{
new ostring[MAX_PLAYER_NAME], astring[128];
strcpy(ostring, gowner[gsaveid[playerid]]);
//new plid;
if (sscanf(inputtext, "u", playerid)) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player ID/Name");
else if (playerid == INVALID_PLAYER_ID) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player");
else
{
//new pname[MAX_PLAYER_NAME];
new targetid = ReturnUser(inputtext);
GetPlayerName(playerid, targetid, MAX_PLAYER_NAME);
if(!strcmp(gowner[gsaveid[playerid]], targetid))
{
format(astring, 128, ""COL_WHITE"%s is already the owner of the gate %i", targetid, gsaveid[playerid]);
SendClientMessage(playerid, -1, astring);
}
else
{
new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
INI_SetTag(gatefile, "data");
INI_WriteString(gatefile, "owner", targetid);
INI_Close(gatefile);
if (!strcmp(ostring, "none")) format(astring, 128, ""COL_GREEN"You have set %s to be the owner of the gate %i.", targetid, gsaveid[playerid]);
else format(astring, 128, ""COL_GREEN"%s is no longer the owner of the gate %i. %s is the new owner", ostring, gsaveid[playerid], targetid);
SendClientMessage(playerid, -1, astring);
}
}
}
}
Re: Only taking id0 even if i type id 1 -
SyS - 09.07.2016
what error? and the code you put is logically wrong too
Re: Only taking id0 even if i type id 1 -
MayaEU - 09.07.2016
Can you help me how to fix it please?
pawn Код:
error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 3)
Re: Only taking id0 even if i type id 1 -
SyS - 09.07.2016
PHP код:
if (dialogid == DIALOG_NEWGOWNER)
{
if (response)
{
new ostring[MAX_PLAYER_NAME], astring[128];
strcpy(ostring, gowner[gsaveid[playerid]]);
new plid;
if (sscanf(inputtext, "u", plid)) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player ID/Name");
else if (playerid == INVALID_PLAYER_ID) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player");
else
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
if(!strcmp(gowner[gsaveid[plid]], pname))
{
format(astring, 128, ""COL_WHITE"%s is already the owner of the gate %i", pname, gsaveid[playerid]);
SendClientMessage(playerid, -1, astring);
}
else
{
new INI:gatefile = INI_Open(GateINI(gsaveid[playeridd]));
INI_SetTag(gatefile, "data");
INI_WriteString(gatefile, "owner", pname);
INI_Close(gatefile);
if (!strcmp(ostring, "none")) format(astring, 128, ""COL_GREEN"You have set %s to be the owner of the gate %i.", pname, gsaveid[playerid]);
else format(astring, 128, ""COL_GREEN"%s is no longer the owner of the gate %i. %s is the new owner", ostring, gsaveid[playerid], pname);
SendClientMessage(playerid, -1, astring);
}
}
}
}
try them