SA-MP Forums Archive
/accent - 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: /accent (/showthread.php?tid=656429)



/accent - Jaua10 - 15.07.2018

Hey guys im trying to make a command but dont work for me its the /accent [accent] [text] , i want save it on the enum pAccent

I got this:

PHP код:
CMD:accent(playeridparams[])
{
    if(
strlen(cmdtext) < 9)
    return 
SendClientMessage(playerid0xFFFFFFFF"USAGE /accent [Accent]");
    new 
string[60];
    
SetPVarString(playerid"Accent"cmdtext[8]);
    
format(string60"You have set your accent to %s."cmdtext[8]);
    
SendClientMessage(playerid0x33CCFFAAstring);
    return 
1;

what am i missing?

Код:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2684) : warning 217: loose indentation
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2866) : error 017: undefined symbol "cmdtext"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : error 017: undefined symbol "cmdtext"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : error 001: expected token: ";", but found "]"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: /accent - Florin48 - 15.07.2018

CMD:accent(playerid, params[])
{

if(strlen(params) < 9)
return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE /accent [Accent]");
new string[60];
SetPVarString(playerid, "Accent", params[8]);
format(string, 60, "You have set your accent to %s.", params[8]);
SendClientMessage(playerid, 0x33CCFFAA, string);
return 1;
}

I did not test the order, I do not know if it works, I just replaced something and did not make a mistake.


Re: /accent - ItsRobinson - 15.07.2018



Change cmdtext to params


Re: /accent - Jaua10 - 15.07.2018

It just say "You have set your accent to n" and when you write anithing dont shows the accent

http://prntscr.com/k6rvld


Re: /accent - Iguman - 15.07.2018

Untested but should work. Study the code.

PHP код:
CMD:accent(playeridparams[])
{
    new 
accent[50];
    if(
sscanf(params"s[50]"accent)) return SendClientMessage(playeridCOLOR_RED"USAGE: /accent [accent]");
    if(
strlen(accent) < || strlen(accent) > 50) return SendClientMessage(playeridCOLOR_RED"ERROR: Invalid accent length. It has to be greater than 9 and less than 50 characters.");
    
SetPVarString(playerid"Accent"accent);
    new 
string[128];
    
format(stringsizeof(string), "You have set your accent to: %s."accent);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    return 
1;




Re: /accent - DerickClark - 15.07.2018

use the string as format.

For example. Here my code.
Код:
CMD:setmessage(playerid,params[])
{
	new Message[128], string[128];
        if(sscanf(params,"s[128]", Message)) return SendClientMessage(playerid, -1, "Usage: /setmessage [custom_message]");
   	format(string, sizeof(string), "You have set your Join Message to: %s", Message);
	SendClientMessage(playerid, -1, string);
	format(PlayerInfo[playerid][personalmsg], 128, "%s", Message);
	return 1;
}



Re: /accent - Dayrion - 15.07.2018

Quote:
Originally Posted by Jaua10
Посмотреть сообщение
Hey guys im trying to make a command but dont work for me its the /accent [accent] [text] , i want save it on the enum pAccent

I got this:

PHP код:
CMD:accent(playeridparams[])
{
    if(
strlen(cmdtext) < 9)
    return 
SendClientMessage(playerid0xFFFFFFFF"USAGE /accent [Accent]");
    new 
string[60];
    
SetPVarString(playerid"Accent"cmdtext[8]);
    
format(string60"You have set your accent to %s."cmdtext[8]);
    
SendClientMessage(playerid0x33CCFFAAstring);
    return 
1;

what am i missing?

Код:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2684) : warning 217: loose indentation
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2866) : error 017: undefined symbol "cmdtext"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : error 017: undefined symbol "cmdtext"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : error 001: expected token: ";", but found "]"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2869) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Happens frequently when you copy/paste code without understand any words.


Re: /accent - CodeStyle175 - 15.07.2018

why are you even doing such things coding isn't writing just plain code, when you want to be successful you need to learn some basics.


Re: /accent - Jaua10 - 15.07.2018

Quote:
Originally Posted by Iguman
Посмотреть сообщение
Untested but should work. Study the code.

PHP код:
CMD:accent(playeridparams[])
{
    new 
accent[50];
    if(
sscanf(params"s[50]"accent)) return SendClientMessage(playeridCOLOR_RED"USAGE: /accent [accent]");
    if(
strlen(accent) < || strlen(accent) > 50) return SendClientMessage(playeridCOLOR_RED"ERROR: Invalid accent length. It has to be greater than 9 and less than 50 characters.");
    
SetPVarString(playerid"Accent"accent);
    new 
string[128];
    
format(stringsizeof(string), "You have set your accent to: %s."accent);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    return 
1;

the code works but dont save the accent:

http://prntscr.com/k6sauh


Re: /accent - Iguman - 15.07.2018

Post everything under OnPlayerText callback


Re: /accent - Jaua10 - 15.07.2018

Код:
public OnPlayerText(playerid, text[])
{
    if (realchat)
	{
	    new string[128];
		format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
  		ProxDetector(30.0, playerid, string,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION);
		format(string, sizeof(string), "says: %s", text);
		SetPlayerChatBubble(playerid,string,COLOR_YELLOW,5.0,5000);
		ApplyAnimation(playerid,"PED","IDLE_CHAT",2.0,1,0,0,1,1);
		return 0;
	}
	IdleTime[playerid] = 0;
	return 1;
}



Re: /accent - Iguman - 15.07.2018

You can't expect something to happen if you didn't create it at all.

PHP код:
public OnPlayerText(playeridtext[])
{
    if(
realchat)
    {
        new 
string[128], accent[50];
        
strmid(accentGetPVarString(playerid"Accent"); , 05050);
        if(
strlen(accent))
            
format(stringsizeof(string), "[%s] %s says: %s"accentGetName(playerid), text);
        else
            
format(stringsizeof(string), "%s says: %s"GetName(playerid), text);
          
ProxDetector(30.0playeridstring,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION);
        
format(stringsizeof(string), "says: %s"text);
        
SetPlayerChatBubble(playerid,string,COLOR_YELLOW,5.0,5000);
        
ApplyAnimation(playerid,"PED","IDLE_CHAT",2.0,1,0,0,1,1);
        return 
0;
    }
    
IdleTime[playerid] = 0;
    return 
1;




Re: /accent - Jaua10 - 15.07.2018

what is this?

Код:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 035: argument type mismatch (argument 2)
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 001: expected token: ";", but found ")"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
PHP код:
strmid(accentGetPVarString(playerid"Accent"); , 05050); 



Re: /accent - DerickClark - 15.07.2018

Quote:
Originally Posted by Jaua10
Посмотреть сообщение
what is this?

Код:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 035: argument type mismatch (argument 2)
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 001: expected token: ";", but found ")"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
PHP код:
strmid(accentGetPVarString(playerid"Accent"); , 05050); 
Copy and Pasting won't make it work Lol.


Re: /accent - Iguman - 15.07.2018

my bad, sorry

replace
PHP код:
strmid(accentGetPVarString(playerid"Accent"); , 05050); 
with
PHP код:
strmid(accentGetPVarString(playerid"Accent"), 05050); 



Re: /accent - Jaua10 - 15.07.2018

Код:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 035: argument type mismatch (argument 2)
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2690) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
same pal:

PHP код:
strmid(accentGetPVarString(playerid"Accent"), 05050); 



Re: /accent - DerickClark - 15.07.2018

Quote:
Originally Posted by Jaua10
Посмотреть сообщение
Код:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : warning 202: number of arguments does not match definition
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1103) : error 035: argument type mismatch (argument 2)
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(2690) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
same pal:

PHP код:
strmid(accentGetPVarString(playerid"Accent"), 05050); 
Ofcouse it won't work. Cause you are copy and pasting.


Re: /accent - Kane - 15.07.2018

It's pretty simple, don't understand all the complications in this post. And also, GetPVarString returns the length of the string, not the string value. You can't plug it into strmid.

PHP код:
CMD:accentplayeridcmdtext[] )
{
    if(
strlencmdtext ) < )
    {
        
SendClientMessageplayerid0xFFFFFFFF"USAGE: /accent [text]" );
        return 
1;
    }
    new 
        
szString120 ];
    
SetPVarStringplayerid"Accent"cmdtext );
    
formatszStringsizeofszString ), "You have set your accent to %s."cmdtext );
    
SendClientMessageplayerid0x33CCFFAAszString );
    return 
1;
}
public 
OnPlayerTextplayeridtext[] )
{
    new 
szText128 ];
    if( 
realchat )
    {
        new 
szAccent60 ];
        
GetPVarStringplayerid"Accent"szAccentsizeofszAccent ) );
        if( !
isnullszAccent ) ) {
            
formatszTextsizeofszText ), "[%s] %s says: %s"szAccentGetNameplayerid ), text );
        } else {
            
formatszTextsizeofszText ), "%s says: %s"GetNameplayerid ), text );
        }
        
ProxDetector30.0playeridszText ,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION,COLOR_CORRECTION );
        
formatszTextsizeofszText ), "says: %s"text );
        
SetPlayerChatBubbleplayeridszTextCOLOR_YELLOW5.05000 );
        
ApplyAnimation(playerid,"PED","IDLE_CHAT",2.0,1,0,0,1,1); 
        return 
0
    }
    
IdleTimeplayerid ] = 0;
    return 
1;

Haven't compiled it, should work though.