SA-MP Forums Archive
How to insert? - 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: How to insert? (/showthread.php?tid=343363)



How to insert? - Dziugsas - 17.05.2012

Hello friiends.i want to ask you how to insert this code :

Code:
	else if invited[playerid][GetPlayerVirtualWorld(playerid)] = true;
		SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
 		SetPlayerInterior(playerid, HouseInformation[x][interiors]);
 		SetPlayerVirtualWorld(playerid, 15500000 + x);
To here :

Code:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    for(new x; x<houseid; x++)
    {
        if(HouseInformation[x][checkpointidx][0] == checkpointid)
        {
            if(InHouse[playerid] != -1)
            {
                InHouse[playerid] = -1;
                return 1;
            }
            InHouseCP[playerid] = x;
            new Pname[28];
            GetPlayerName(playerid, Pname, 28);
            if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
            {
                SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
                SetPlayerInterior(playerid, HouseInformation[x][interiors]);
                SetPlayerVirtualWorld(playerid, 15500000 + x);
            }
            if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "==|Sis namas parduodamas jei norite /npirkti!");
            return 1;
        }
        if(HouseInformation[x][checkpointidx][1] == checkpointid)
        {
            if(InHouse[playerid] == -1)
            {
                InHouse[playerid] = x;
                return 1;
            }
            SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
        }
    }
    return 1;
}



Re: How to insert? - Dziugsas - 17.05.2012

any help


Re: How to insert? - ViniBorn - 17.05.2012

pawn Code:
if(invited[playerid][GetPlayerVirtualWorld(playerid)] == true)
{
    SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
    SetPlayerInterior(playerid, HouseInformation[x][interiors]);
    SetPlayerVirtualWorld(playerid, 15500000 + x);
}



Re: How to insert? - Dziugsas - 18.05.2012

Tag mismatch

Code:
if(kviestas[playerid][GetPlayerVirtualWorld(playerid)] == true)



Re: How to insert? - milanosie - 18.05.2012

make it a bool


new bool:kviestas[MAX_PLAYERS];

instead of new kviestas[MAX_PLAYERS];


Re: How to insert? - Dziugsas - 18.05.2012

thx helped but now ui have other problem when i type it i says player not exist : tokio zaidejo nera.

Code:
CMD:kviest(playerid, params[])
{
    new name[MAX_PLAYER_NAME];
	new id = GetPlayeridMid(name);
	if(id==INVALID_PLAYER_ID) return SendClientMessage(playerid,GREEN,"==|Klaida: Zaidejo nera!");
	kviestas[id][GetPlayerVirtualWorld(playerid)]=true;
	new kvietimas[24];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	format(kvietimas,sizeof(kvietimas),"==|%s pakviete i savo namus!",name);
	SendClientMessage(id,GREEN,kvietimas);
	GetPlayerName(id,name,MAX_PLAYER_NAME);
	format(kvietimas,sizeof(kvietimas),"==|Jei nori atsaukti kvietima :/nekviest %s",name,name);
	SendClientMessage(playerid,GREEN,kvietimas);
	return 1;
}



Re: How to insert? - milanosie - 18.05.2012

ID isn't set to anything, which means its 0 by default.
You will have to set it to the id you want,

If the id is yourself use playerid.

Otherwise I recommend you using sscanf


Re: How to insert? - Dziugsas - 18.05.2012

i need to do it like this /kviest playername


Re: How to insert? - milanosie - 18.05.2012

pawn Code:
new id;
  if(!sscanf(params, "u", id))
{
//rest of the code here



Re: How to insert? - Dziugsas - 18.05.2012

more explanation