SA-MP Forums Archive
Help me - 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: Help me (/showthread.php?tid=608015)



Help me - SilverStand - 26.05.2016

pawn Код:
CMD:dropgps(playerid,params[])
{
    if(pInfo[playerid][pLogged] == 1)
    {
        new Float:fPos[3];

        if(pInfo[playerid][pUsedGPS] == 1)
        {
            GetPlayerPos(playerid,fPos[0],fPos[1],fPos[2]);
            DayZSA_CreateLootsFunction("GPS",fPos[0]+random(2),fPos[1]+random(2),fPos[2]);
            pInfo[playerid][pUsedGPS] = 0;
            for (new i = 0; i < 6; i++)
            {
                TextDrawShowForPlayer(playerid, MapTD[i]);
            }
            PlayerTextDrawShow(playerid, blockMap[playerid]);
            GangZoneShowForPlayer(playerid,BlockMap,0x000000FF);
            SendClientMessage(playerid,-1,"*"COL_RED" You have dropped your 'GPS'!");
        //  print("message passed");
        }
        else return SendClientMessage(playerid,-1,"*"COL_RED" You're not used your 'GPS'!");
    }
    else {
        SendClientMessage(playerid,-1,"*"COL_RED" You're not loggedin!");
    }
    return 1;
}
what's wrong with this cmd, this cmd is workfully but it always send me a wrong command message


Re: Help me - Slawiii - 26.05.2016

maybe nothing wrong

all other command working normal ?


Re: Help me - SilverStand - 26.05.2016

Quote:
Originally Posted by Slawiii
Посмотреть сообщение
maybe nothing wrong

all other command working normal ?
Yup, all command was working normal


Re: Help me - Dayrion - 26.05.2016

Quote:
Originally Posted by SilverStand
Посмотреть сообщение
[pawn]
what's wrong with this cmd, this cmd is workfully but it always send me a wrong command message
What is "send a wrong command message" ?
Like what?


Re: Help me - SilverStand - 26.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
What is "send a wrong command message" ?
Like what?
SERVER: Unknown Command


Re: Help me - Dayrion - 26.05.2016

Try this :
PHP код:
CMD:dropgps(playerid,params[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        new 
Float:fPos[3];
        if(
pInfo[playerid][pUsedGPS] == 1)
        {
            
GetPlayerPos(playerid,fPos[0],fPos[1],fPos[2]);
            
DayZSA_CreateLootsFunction("GPS",fPos[0]+random(2),fPos[1]+random(2),fPos[2]);
            
pInfo[playerid][pUsedGPS] = 0;
            for (new 
06i++)
            {
                
TextDrawShowForPlayer(playeridMapTD[i]);
            }
            
PlayerTextDrawShow(playeridblockMap[playerid]);
            
GangZoneShowForPlayer(playerid,BlockMap,0x000000FF);
            
SendClientMessage(playerid,-1,"*"COL_RED" You have dropped your 'GPS'!");
        
//    print("message passed");
            
return 1;
        }
        else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not used your 'GPS'!");
    }
    else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not loggedin!");




Re: Help me - justice96 - 26.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Try this :
PHP код:
CMD:dropgps(playerid,params[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        new 
Float:fPos[3];
        if(
pInfo[playerid][pUsedGPS] == 1)
        {
            
GetPlayerPos(playerid,fPos[0],fPos[1],fPos[2]);
            
DayZSA_CreateLootsFunction("GPS",fPos[0]+random(2),fPos[1]+random(2),fPos[2]);
            
pInfo[playerid][pUsedGPS] = 0;
            for (new 
06i++)
            {
                
TextDrawShowForPlayer(playeridMapTD[i]);
            }
            
PlayerTextDrawShow(playeridblockMap[playerid]);
            
GangZoneShowForPlayer(playerid,BlockMap,0x000000FF);
            
SendClientMessage(playerid,-1,"*"COL_RED" You have dropped your 'GPS'!");
        
//    print("message passed");
            
return 1;
        }
        else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not used your 'GPS'!");
    }
    else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not loggedin!");
        return 
1;

Edited a bit more, I shouldn't be at 12:57 AM


Re: Help me - SilverStand - 26.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Try this :
PHP код:
CMD:dropgps(playerid,params[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        new 
Float:fPos[3];
        if(
pInfo[playerid][pUsedGPS] == 1)
        {
            
GetPlayerPos(playerid,fPos[0],fPos[1],fPos[2]);
            
DayZSA_CreateLootsFunction("GPS",fPos[0]+random(2),fPos[1]+random(2),fPos[2]);
            
pInfo[playerid][pUsedGPS] = 0;
            for (new 
06i++)
            {
                
TextDrawShowForPlayer(playeridMapTD[i]);
            }
            
PlayerTextDrawShow(playeridblockMap[playerid]);
            
GangZoneShowForPlayer(playerid,BlockMap,0x000000FF);
            
SendClientMessage(playerid,-1,"*"COL_RED" You have dropped your 'GPS'!");
        
//    print("message passed");
            
return 1;
        }
        else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not used your 'GPS'!");
    }
    else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not loggedin!");

That give me a same result


Re: Help me - SilverStand - 26.05.2016

Quote:
Originally Posted by justice96
Посмотреть сообщение
Edited a bit more, I shouldn't be at 12:57 AM
warning 225: unreachable code


Re: Help me - Darkwood17 - 26.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Try this :
PHP код:
CMD:dropgps(playerid,params[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        new 
Float:fPos[3];
        if(
pInfo[playerid][pUsedGPS] == 1)
        {
            
GetPlayerPos(playerid,fPos[0],fPos[1],fPos[2]);
            
DayZSA_CreateLootsFunction("GPS",fPos[0]+random(2),fPos[1]+random(2),fPos[2]);
            
pInfo[playerid][pUsedGPS] = 0;
            for (new 
06i++)
            {
                
TextDrawShowForPlayer(playeridMapTD[i]);
            }
            
PlayerTextDrawShow(playeridblockMap[playerid]);
            
GangZoneShowForPlayer(playerid,BlockMap,0x000000FF);
            
SendClientMessage(playerid,-1,"*"COL_RED" You have dropped your 'GPS'!");
        
//    print("message passed");
            
return 1;
        }
        else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not used your 'GPS'!");
    }
    else return 
SendClientMessage(playerid,-1,"*"COL_RED" You're not loggedin!");

To @Dayrion:
Every command should always have return a value at the end, otherwise you will get the "unreachable code" warning.

To the OP:
Your command is not readable:
Код:
CMD:dropgps(playerid,params[])
{
	new Float:fPos[3];
	if(pInfo[playerid][pLogged] == 0) return SendClientMessage(playerid, -1, "*"COL_RED" You're not loggedin!");
	if(pInfo[playerid][pUsedGPS] == 0) return SendClientMessage(playerid, -1, "*"COL_RED" You're not used your 'GPS'!");
	GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
	DayZSA_CreateLootsFunction("GPS", fPos[0]+random(2), fPos[1]+random(2), fPos[2]);
	pInfo[playerid][pUsedGPS] = 0;
 	for (new i = 0; i < 6; i++)
	{
		//TextDrawShowForPlayer(playerid, MapTD[i]);
	}
	PlayerTextDrawShow(playerid, blockMap[playerid]);
	GangZoneShowForPlayer(playerid, BlockMap, 0x000000FF);
	SendClientMessage(playerid, -1, "*"COL_RED" You have dropped your 'GPS'!");
	print("message passed");
	return 1;
}
If you still get the unknown command message, the problem probably is out of the command.