SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/07/2019, 12:44 PM   #1
playstores
Big Clucker
 
Join Date: Feb 2018
Location: Germany
Posts: 195
Reputation: 19
Default STOCK Problem!

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;
}
playstores is offline   Reply With Quote
Old 17/07/2019, 12:46 PM   #2
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,177
Reputation: 73
Default Re: STOCK Problem!

remove , from inside strings "LSPD," "LSPD"
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Old 17/07/2019, 12:49 PM   #3
SyS
High-roller
 
SyS's Avatar
 
Join Date: Oct 2015
Posts: 1,939
Reputation: 504
Default Re: STOCK Problem!

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.
SyS is offline   Reply With Quote
Old 17/07/2019, 01:03 PM   #4
playstores
Big Clucker
 
Join Date: Feb 2018
Location: Germany
Posts: 195
Reputation: 19
Default Re: STOCK Problem!

Mugala was right but.

Maybe there is something wrong with strmcp ?

https://pastebin.com/pkXpQ5Qj
playstores is offline   Reply With Quote
Old 17/07/2019, 01:18 PM   #5
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,177
Reputation: 73
Default Re: STOCK Problem!

nothing wrong, but there are some better ways.
isn't it working?
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Old 17/07/2019, 02:10 PM   #6
playstores
Big Clucker
 
Join Date: Feb 2018
Location: Germany
Posts: 195
Reputation: 19
Default Re: STOCK Problem!

No and Idk why

https://pastebin.com/ukuApLSt
playstores is offline   Reply With Quote
Old 17/07/2019, 02:31 PM   #7
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,177
Reputation: 73
Default Re: STOCK Problem!

first code is correct, you get only 9999 in first one?
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Old 17/07/2019, 04:23 PM   #8
NeXTGoD
Banned
 
Join Date: Jul 2018
Posts: 118
Reputation: 9
Default Re: STOCK Problem!

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;
}
NeXTGoD is offline   Reply With Quote
Old 17/07/2019, 04:53 PM   #9
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,177
Reputation: 73
Default Re: STOCK Problem!

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.
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stock problem C0oL3r Scripting Help 5 16/02/2018 11:24 PM
Stock problem Face9000 Scripting Help 8 15/04/2013 10:09 PM
Problem with stock Konstantinos Scripting Help 4 13/11/2012 03:52 PM
stock Problem grand.Theft.Otto Help Archive 2 25/07/2011 04:20 AM
stock problem . Mean Help Archive 3 29/12/2010 09:14 AM


All times are GMT. The time now is 03:36 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.