SA-MP Forums Archive
STOCK Problem! - 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: STOCK Problem! (/showthread.php?tid=668016)



STOCK Problem! - playstores - 17.07.2019

Nothing happens if I use this, whats the matter?

stock GetFactionIDByName(frakname[])
{

if(!strcmp(frakname,"LSPD,",true))
{
return 1;
}
else if(!strcmp(frakname,"FBI,",true))
{
return 2;
}
else if(!strcmp(frakname,"Bundeswehr,",true))
{
return 3;
}
else if(!strcmp(frakname,"Sanitдter,",true))
{
return 4;
}
else if(!strcmp(frakname,"LCM,",true))
{
return 5;
}
else if(!strcmp(frakname,"Yakuza,",true))
{
return 6;
}
else if(!strcmp(frakname,"Prдsident,",true))
{
return 7;
}
else if(!strcmp(frakname,"Hitman,",true))
{
return 8;
}
else if(!strcmp(frakname,"San News,",true))
{
return 9;
}
else if(!strcmp(frakname,"Transport GmbH,",true))
{
return 10;
}
else if(!strcmp(frakname,"Fahrlehrer,",true))
{
return 11;
}
else if(!strcmp(frakname,"Triaden,",true))
{
return 12;
}
else if(!strcmp(frakname,"Grove,",true))
{
return 13;
}
else if(!strcmp(frakname,"Ballas,",true))
{
return 14;
}
else if(!strcmp(frakname,"Feuerwehr,",true))
{
return 15;
}
else if(!strcmp(frakname,"Vagos,",true))
{
return 16;
}
else if(!strcmp(frakname,"Aztecas,",true))
{
return 17;
}
else if(!strcmp(frakname,"SF Rifa,",true))
{
return 18;
}
else if(!strcmp(frakname,"Red Soldiers,",true))
{
return 19;
}
else if(!strcmp(frakname,"Terroristen,",true))
{
return 20;
}
else if(!strcmp(frakname,"Wheelmen Agency,",true))
{
return 21;
}
else if(!strcmp(frakname,"S.W.A.T,",true))
{
return 22;
}
else if(!strcmp(frakname,"Russen Mafia",true))
{
return 23;
}
else if(!strcmp(frakname,"Ordnungsamt",true))
{
return 24;
}
else return 9999;
}


Re: STOCK Problem! - Mugala - 17.07.2019

remove , from inside strings "LSPD," "LSPD"


Re: STOCK Problem! - SyS - 17.07.2019

You should provide more details.What you were expecting to happen? What you getting now?And properly ident and enclose the code in [php] or [code] tags so that others can read it.


Re: STOCK Problem! - playstores - 17.07.2019

Mugala was right but.

Maybe there is something wrong with strmcp ?

https://pastebin.com/pkXpQ5Qj


Re: STOCK Problem! - Mugala - 17.07.2019

nothing wrong, but there are some better ways.
isn't it working?


Re: STOCK Problem! - playstores - 17.07.2019

No and Idk why

https://pastebin.com/ukuApLSt


Re: STOCK Problem! - Mugala - 17.07.2019

first code is correct, you get only 9999 in first one?


Re: STOCK Problem! - NeXTGoD - 17.07.2019

Try by ID and not by name it will work

Code:
stock GetFactionNameByID(classid)
{
    new String[30];
    switch(classid)
    {
        case 0: String = "Class One";
        case 1: String = "Class Two";
    }
    return String;
}



Re: STOCK Problem! - Mugala - 17.07.2019

Quote:
Originally Posted by NeXTGoD
View Post
Try by ID and not by name it will work

Code:
stock GetFactionNameByID(classid)
{
    new String[30];
    switch(classid)
    {
        case 0: String = "Class One";
        case 1: String = "Class Two";
    }
    return String;
}
yeah but he wants to get by name, there is a big difference.