giveplayerid error
#1

I'm creating this public.
pawn Код:
forward SearchCallHome(playerid);
public SearchCallHome(playerid)
{
    new string[128];
    new name[24];
    GetPlayerName(giveplayerid, name, sizeof(name));//error line
    format(string, sizeof(string),"I need information about %s's House. Contact me when you find it.", name);
    ProxDetector(20.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
}
And I gets an error on the giveplayerid. How can I fix it?
Код:
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(91130) : error 017: undefined symbol "giveplayerid"
Reply
#2

i wonder why do you type giveplayerid in GetPlayerName, just replace it with playerid
Reply
#3

pawn Код:
forward SearchCallHome(playerid);
public SearchCallHome(playerid)
{
    new string[90];
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));//error line
    format(string, sizeof(string),"I need information about %s's House. Contact me when you find it.", name);
    ProxDetector(20.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
}
Reply
#4

pawn Код:
forward SearchCallHome(playerid,giveplayerid);
public SearchCallHome(playerid,giveplayerid)
{
    new string[128];
    new name[24];
    GetPlayerName(giveplayerid, name, sizeof(name));//error line
    format(string, sizeof(string),"I need information about %s's House. Contact me when you find it.", name);
    ProxDetector(20.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
}
Try it, but I don't know if it would work for you since I don't know when you call SearCallHome
Reply
#5

Quote:
Originally Posted by kirollos
Посмотреть сообщение
i wonder why do you type giveplayerid in GetPlayerName, just replace it with playerid
It's called when you search for another players name and giveplayerid is the other player, playerid is the player who search

Quote:
Originally Posted by knackworst
Посмотреть сообщение
pawn Код:
forward SearchCallHome(playerid,giveplayerid);
public SearchCallHome(playerid,giveplayerid)
{
    new string[128];
    new name[24];
    GetPlayerName(giveplayerid, name, sizeof(name));//error line
    format(string, sizeof(string),"I need information about %s's House. Contact me when you find it.", name);
    ProxDetector(20.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
}
Try it, but I don't know if it would work for you since I don't know when you call SearCallHome
Will try it
Reply
#6

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
It's called when you search for another players name and giveplayerid is the other player, playerid is the player who search



Will try it
If it doesn't work then show the line where you call it
Reply
#7

Didnt work. It was my name and not the other. This is the cmd where i call it
pawn Код:
if(strcmp(cmd, "/search", true) == 0)
    {
        if(IsAHitman(playerid))
        {
            new x_nr[24];
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /search [name] [playerid/PartOfName]");
                SendClientMessage(playerid, COLOR_GREY, "Available names: house, vehicle, vehicle2, vehicle3");
                return 1;
            }
            if(strcmp(x_nr,"house", true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search house [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallHome", 2000,false,"i",playerid);
                            SetTimerEx("SearchHome",5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallHome", 2000,false,"i",playerid);
                            SetTimerEx("SearchHome", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
            if(strcmp(x_nr,"vehicle", true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
            if(strcmp(x_nr,"vehicle2",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle2 [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle2", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle2", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
            if(strcmp(x_nr,"vehicle3",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle3 [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle3", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle3", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command!");
            return 1;
        }
        return 1;
    }
Reply
#8

How can the tell the script who is the other player in the public btw?
Reply
#9

pawn Код:
if(strcmp(cmd, "/search", true) == 0)
    {
        if(IsAHitman(playerid))
        {
            new x_nr[24];
            x_nr = strtok(cmdtext, idx);
            if(!strlen(x_nr))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /search [name] [playerid/PartOfName]");
                SendClientMessage(playerid, COLOR_GREY, "Available names: house, vehicle, vehicle2, vehicle3");
                return 1;
            }
            if(strcmp(x_nr,"house", true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search house [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallHome", 2000,false,"ii",playerid,giveplayerid);
                            SetTimerEx("SearchHome",5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallHome", 2000,false,"ii",playerid,giveplayerid);
                            SetTimerEx("SearchHome", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
            if(strcmp(x_nr,"vehicle", true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
            if(strcmp(x_nr,"vehicle2",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle2 [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle2", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle2", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
            if(strcmp(x_nr,"vehicle3",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle3 [playerid/PartOfName]");
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(!IsPlayerInAnyVehicle(playerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle3", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
                            ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
                            SetTimerEx("SearchVehicle3", 5000,false,"i",playerid);
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
                            CommandLog(string);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
                    return 1;
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command!");
            return 1;
        }
        return 1;
    }
Try this instead
EDIT: my bad, now it should work
Reply
#10

pawn Код:
if(IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
Pointless checking. If the players are connected, then they simply not invalid players.

pawn Код:
SetTimerEx("SearchCallHome", 2000,false,"i",playerid);
Of course, it won't. You pass only playerid as parameter when it should be:
pawn Код:
SetTimerEx("SearchCallHome", 2000,false,"ii",playerid, giveplayerid);
But still.. wouldn't it be better without the timer? Just calling a function and do the rest?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)