[Ajuda] passar string por parametro
#1

Queria passar por parametro funзхes com strings, como essas que estгo dando errado:
PHP Code:
GetPlayerLevel(playerid, "lvl");
if(
skillid == "lvl") skillid = experience[playerid]; 
Nгo da pra fazer isso?


Exemplos:
PHP Code:
if(skillid == "lvl") skillid = experience[playerid]; 
PHP Code:
stock GetPlayerLevel(playerid, skillid) {
    new 
lvl = 1;
    if(
skillid == "lvl") skillid = experience[playerid];
    else if(
skillid == "mecanic") skillid = MECANICskills[playerid];
    new 
nextlvl = GetPlayerExpToNextLVL(lvl);
    while(
skillid >= nextlvl) {
        
skillid -= nextlvl;
        
lvl++;
        
nextlvl = GetPlayerExpToNextLVL(lvl);
    }
    return 
lvl;
} 
Reply
#2

Use strcmp para comparar strings.

E tambйm, faзa assim:
PHP Code:
stock GetPlayerLevel(playerid, skillid[]) 
Reply
#3

Quote:
Originally Posted by ipsLuan
View Post
Use strcmp para comparar strings.

E tambйm, faзa assim:
PHP Code:
stock GetPlayerLevel(playerid, skillid[]) 
Pdc, vlw +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)