SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem :| (/showthread.php?tid=249605)



Problem :| - park4bmx - 19.04.2011

SOLVED
Problem Solved go to further comments


Re: Problem :| - nuriel8833 - 19.04.2011

Does those lines:
PHP код:
new name[MAX_PLAYER_NAME],file[80];GetPlayerName(playeridnamesizeof(name));format(file,sizeof(file),"%s.txt",name);
    
INI_ParseFile(file"PlayerStatusClass"falsetrueplayeridtruefalse );
    new 
ClassInfo[20]; GetPVarString(playerid"SoldierInfo"ClassInfosizeof ClassInfo);
    if(!
strcmp("Soldier",ClassInfo,true))
        {
            
ShowPlayerDialog(playerid,WeaponShop ,DIALOG_STYLE_MSGBOX,"bla bla","|Soldier|","Buy","Cancel");
            new 
string[128]; format(string,sizeof(string),"levelNow: %d",ClassInfo); //i got this so i can see if the player is a Soldier.
            
SendClientMessage(playerid,YELLOW,string);//  But it allways Prints [levelNow: 0] :(
        
}
        else
        {
            
ShowPlayerDialog(playerid,WeaponShop ,DIALOG_STYLE_MSGBOX,"bla bal",""xRED"Nothing Found","Buy","Cancel");
        } 
Go into any public or stock?


Re: Problem :| - park4bmx - 19.04.2011

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
Does those lines:
Go into any public or stock?
yes of course D they go into OnPlayerPickUpPickup
and i forgot to add something
when the player Enters The pickup and he is not a Soldier the Dialog Will still show for him


Re: Problem :| - nuriel8833 - 19.04.2011

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
yes of course D they go into OnPlayerPickUpPickup
and i forgot to add something
when the player Enters The pickup and he is not a Soldier the Dialog Will still show for him
I am not sure but I think this is your mistake:
PHP код:
Default Problem :|
im trying to make a dialog only for a Soldier but it doesnt work
the code
pawn Code
:
forward PlayerStatusClass(playeridname[], value[]);
public 
PlayerStatusClass(playeridname[], value[])
{
if(!
strcmp(name"SoldierInfo"))SetPVarInt(playerid,"SoldierInfo"strval(value ));
}
//later On in the script under OnPlayerPickUpPickup and yes i do have the pickup id and everything
new name[MAX_PLAYER_NAME],file[80];GetPlayerName(playeridnamesizeof(name));format(file,sizeof(file),"%s.txt",name);
    
INI_ParseFile(file"PlayerStatusClass"falsetrueplayeridtruefalse );
    new 
ClassInfo[20]; GetPVarString(playerid"SoldierInfo"ClassInfosizeof ClassInfo);
    if(
strcmp("Soldier",ClassInfo,true))
        {
            
ShowPlayerDialog(playerid,WeaponShop ,DIALOG_STYLE_MSGBOX,"bla bla","|Soldier|","Buy","Cancel");
            new 
string[128]; format(string,sizeof(string),"levelNow: %d",ClassInfo); //i got this so i can see if the player is a Soldier.
            
SendClientMessage(playerid,YELLOW,string);//  But it allways Prints [levelNow: 0] :(
        
}
        else
        {
            
ShowPlayerDialog(playerid,WeaponShop ,DIALOG_STYLE_MSGBOX,"bla bal",""xRED"Nothing Found","Buy","Cancel");
        } 
You made that if the player isn't solider he will see the dialog and if he is he won't see it
This was your mistake:
Quote:

if(!strcmp("Soldier",ClassInfo,true))




Re: Problem :| - park4bmx - 19.04.2011

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
I am not sure but I think this is your mistake:
PHP код:
Default Problem :|
im trying to make a dialog only for a Soldier but it doesnt work
the code
pawn Code
:
forward PlayerStatusClass(playeridname[], value[]);
public 
PlayerStatusClass(playeridname[], value[])
{
if(!
strcmp(name"SoldierInfo"))SetPVarInt(playerid,"SoldierInfo"strval(value ));
}
//later On in the script under OnPlayerPickUpPickup and yes i do have the pickup id and everything
new name[MAX_PLAYER_NAME],file[80];GetPlayerName(playeridnamesizeof(name));format(file,sizeof(file),"%s.txt",name);
    
INI_ParseFile(file"PlayerStatusClass"falsetrueplayeridtruefalse );
    new 
ClassInfo[20]; GetPVarString(playerid"SoldierInfo"ClassInfosizeof ClassInfo);
    if(
strcmp("Soldier",ClassInfo,true))
        {
            
ShowPlayerDialog(playerid,WeaponShop ,DIALOG_STYLE_MSGBOX,"bla bla","|Soldier|","Buy","Cancel");
            new 
string[128]; format(string,sizeof(string),"levelNow: %d",ClassInfo); //i got this so i can see if the player is a Soldier.
            
SendClientMessage(playerid,YELLOW,string);//  But it allways Prints [levelNow: 0] :(
        
}
        else
        {
            
ShowPlayerDialog(playerid,WeaponShop ,DIALOG_STYLE_MSGBOX,"bla bal",""xRED"Nothing Found","Buy","Cancel");
        } 
You made that if the player isn't solider he will see the dialog and if he is he won't see it
This was your mistake:
no that was not the problem P;
this was the problem
pawn Код:
if(!strcmp(name, "SoldierInfo"))SetPVarInt(playerid,"SoldierInfo", strval(value ));
I forgot that it was a string so i changed it to
pawn Код:
if(!strcmp(name, "SoldierInfo")) SetPVarString(playerid, "SoldierClassInfo", value);
But stil lThanks For you help


Re: Problem :| - nuriel8833 - 19.04.2011

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
no that was not the problem P;
this was the problem
pawn Код:
if(!strcmp(name, "SoldierInfo"))SetPVarInt(playerid,"SoldierInfo", strval(value ));
I forgot that it was a string so i changed it to
pawn Код:
SetPVarString(playerid, "SoldierClassInfo", value);
But stil lThanks For you help
You are welcomed
Glad the issue was solved,and sorry for misguiding you :/