Jump to content
  • 0

pomoc mishmash array -> string


Deleted User

Dotaz

Mam nasledovny kod:

pLoad(playerid, name[]) {
new nm = strval(name);
Player[playerid][nm] = 7;
}

A hlasi mi to

warning 213: tag mismatch

je to riadok Player....

Zistil som ze je chyba s tym 'nm' ale ja nvm jak to spravne nadefinovat tak pls "help" :d

Link to comment
Share on other sites

21 odpovědí na tuto otázku

Recommended Posts

  • 0
Definicia tohoto

Player[playerid][nm]

 

by mala vypadať takto

 

enum info
{
       nm
}
new Player[MAX_PLAYERS][info];

 

 

to vtom enumu je jako co ?

 

používáš i ; ?

Link to comment
Share on other sites

  • 0

mam

enum info {
Logged,

Wanted
}

enum textdraws {
Text:Head
}
new Player[MAX_PLAYERS][info];

 

a v tom pLoad ma byt 2. parameter nieco z toho enumu

 

-- čtv 18. srp 2011 19:34:55 --

 

vyuzitie

pLoad(playerid, name[]) {
new nm = strval(name);
Player[playerid][nm] = dUserINT(PlayerName(playerid)).(nm);
}

 

miesto toho dlhero riadku staci napisat pLoad

Link to comment
Share on other sites

  • 0

ale nesplni to efekt, nm je premenna napr z Logged alebo Wanted ktore sa zadava do toho pLoad

 

-- čtv 18. srp 2011 19:39:15 --

 

stock pLoad(playerid, name[]) {
if(strcmp(name,"Logged",true))  Player[playerid][Logged] = 7;
if(strcmp(name,"Wanted",true)) Player[playerid][Wanted] = 7;
}

 

Ono by sa to malo dynamycky volat lebo tych premennych v enum bude hafo

Link to comment
Share on other sites

  • 0

pLoad(playerid, name[]) {
  new nm = strval(name);
  Player[playerid][nm] = dUserINT(PlayerName(playerid)).(nm);
}

 

Máš toto hej ? Veď ty nepotrebuješ aby sa niečo rovnalo ukladaniu..

 

pLoad(playerid, name[]) {
  Player[playerid][nm] = strval(name);
  dUserINT(PlayerName(playerid)).(nm);
}

Link to comment
Share on other sites

  • 0

LoL povedz hneď...ináč nwm jak ty ale cez dini sa mi to zdá lepšie...

 

pLoad(playerid) 
{
  Player[playerid][nm] = dUserINT(PlayerName(playerid)).("NM");
  SetPlayerWantedLevel(playerid,dUserINT(PlayerName(playerid)).("Wanted")-GetPlayerWantedLevel(playerid)); 
//Dal som ti sem aj na funkciu aj na premennú...
}

Link to comment
Share on other sites

  • 0

dUserINT(PlayerName(playerid)).(name);

 

dUserINT - ide o integer ktorý budeme získavať

PlayerName(playerid) - z akého súboru .. v dudb.inc je to formátované ako meno.dudb.sav

.("Nieco") - z akého riadku získavame. čiže by to nemala byť premenná ale string

Link to comment
Share on other sites

  • 0

Tak to mal QWER pravdu toto sa ti nepodarí až teraz som pochopil čo potrebuješ...budeš musieť zrejme písať ten dlhý riadok...alebo si dáš len

 

public pLoad(playerid)

 

a do toho si vypíšeš ten dlhý riadok a potom to využiješ ako funkciu...ináč to nepôjde..

Link to comment
Share on other sites

  • 0
Ale nm je premenna, nie staticka hodnota, skusal som este:

 

	Player[playerid][name] = dUserINT(PlayerName(playerid)).(name);

 

ale hlasi:

error 033: array must be indexed (variable "name")

 

name v tom případě musíš mít v enum vytvořený jako string.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...