if(strcmp(cmd, "/giveweaponlicense", true) == 0 || strcmp(cmd, "/gwl", true) == 0)
{
printf("<-[DEBUG]->: Passed GWL 1");
giveplayerid = ReturnUser(tmp);
printf("<-[DEBUG]->: Passed GWL 2");
if(IsPlayerConnected(playerid))
{
printf("<-[DEBUG]->: Passed GWL 3");
if (PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
printf("<-[DEBUG]->: Passed GWL 4");
if(giveplayerid != INVALID_PLAYER_ID)
{
printf("<-[DEBUG]->: Passed GWL 5");
new Float:x, Float:y, Float:z;
printf("<-[DEBUG]->: Passed GWL 6");
GetPlayerPos(giveplayerid,x,y,z);
printf("<-[DEBUG]->: Passed GWL 7");
if(PlayerInfo[playerid][pRank] < 2)
{
printf("<-[DEBUG]->: Passed GWL 8");
SendClientMessage(playerid, COLOR_GRAD1, " You need to be Rank 2 to give license!");
return 1;
}
if(!PlayerToPoint(15, playerid, x, y, z))
{
printf("<-[DEBUG]->: Passed GWL 9");
SendClientMessage(playerid, COLOR_GRAD1, " Player is not near you!");
printf("<-[DEBUG]->: Passed GWL ");
return 1;
}
if(PlayerInfo[giveplayerid][pGunLic] == 1)
{
printf("<-[DEBUG]->: Passed GWL 10");
SendClientMessage(playerid, COLOR_GRAD1, " Player already haves weapon license.");
printf("<-[DEBUG]->: Passed GWL 11");
return 1;
}
printf("<-[DEBUG]->: Passed GWL 12");
PlayerInfo[giveplayerid][pGunLic] = 1;
printf("<-[DEBUG]->: Passed GWL 13");
GetPlayerName(playerid, sendername, sizeof(sendername));
printf("<-[DEBUG]->: Passed GWL 14");
format(string, sizeof(string), "* Officer %s gave you Weapons License.", sendername);
printf("<-[DEBUG]->: Passed GWL 15");
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
printf("<-[DEBUG]->: Passed GWL 16");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
printf("<-[DEBUG]->: Passed GWL 17");
format(string, sizeof(string), "* You gave Weapons License to %s.",giveplayerid);
printf("<-[DEBUG]->: Passed GWL 18");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
printf("<-[DEBUG]->: Passed GWL 19");
}
}
else
{
printf("<-[DEBUG]->: Passed GWL 20 FINAL!");
SendClientMessage(playerid, COLOR_GRAD1, " You are not Cop!");
return 1;
}
}
return 1;
}
Originally Posted by SaiBerFun
Ask in the scripts thread!
|
printf("giveplayeris = %d", giveplayerid);
giveplayerid = ReturnUser(tmp);
Originally Posted by player007
Add
Код:
printf("giveplayeris = %d", giveplayerid); Код:
giveplayerid = ReturnUser(tmp); |
giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
Originally Posted by player007
Okay, the problem is with this:
Код:
giveplayerid = ReturnUser(tmp); (Because this check fails: Код:
if(giveplayerid != INVALID_PLAYER_ID) |
Originally Posted by player007
No that's not going to work. If the giveplayerid is invalid, it can't be used, you can't do anything for the not-existing player. Check the ReturnUser, because the problem originates from there (as it returns INVALID_PLAYER_ID)
|
if(strcmp(cmd, "/giveweaponlicense", true) == 0 || strcmp(cmd, "/gwl", true) == 0)
{
tmp = strtok(cmdtext, idx);