[HELP] Command to insert and remove player of police does not work
#1

[HELP]
I have 2 errors in commands LIEUTENANT profession.
1є I want to put a player like police , for this the LIEUTENANT must enter / cnp [ID ] but says that I'm not allowed (I am lieutenant) .

2є The command / tdp serves to ward off the player police profession but says that this command does not exist.

Print do comando /cnp :http://i.imgur.com/kQIBw2p.png
Print do comando /tdp : http://i.imgur.com/AcliqWa.png
Reply
#2

  1. Don't take screenshots of text. Copy-paste works just fine.
  2. Indent properly. I'm not even going to try to decipher this mess.
Reply
#3

/tdp
Quote:

if(strcmp(cmd, "/tdp", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file,"Tenente") >= 0){
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "* Digite: /tdp [id].");
return 1;
}

/cnp
Quote:

f(strcmp(cmd, "/cnp", true) == 0) {
new id;
//new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "/cnp [id]");
return 1;
}
id = strval(tmp);
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file,"Tenente") == 1)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(id, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
dini_IntSet(file2, "Punidoo", 0);
format(string, sizeof(string),"O Tenente %s(ID: %d) colocou %s(ID:%d) na policia novamente", aname, playerid,pname,id);
SendClientMessageToAll(0xFF66FFAA, string);
} else {
SendClientMessage(playerid, Vermelho, "** {6DB3FE}Vocк nгo tem permissгo.");
}
return 1;
}

It has three years we do not move more , I forgot a lot and decided to reopen . Please help me .
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
  1. Don't take screenshots of text. Copy-paste works just fine.
  2. Indent properly. I'm not even going to try to decipher this mess.
Intend your code. This is unreadable.
Reply
#5

@ edit
Code:
/cnp:
Код:
if(strcmp(cmd, "/cnp", true) == 0) {
new id;
//new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "/cnp [id]");
return 1;
}
id = strval(tmp);
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file,"Tenente") == 1)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(id, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
dini_IntSet(file2, "Punidoo", 0);
format(string, sizeof(string),"O Tenente %s(ID: %d) colocou %s(ID:%d) na policia novamente", aname, playerid,pname,id);
SendClientMessageToAll(0xFF66FFAA, string);
} else {
SendClientMessage(playerid, Vermelho, "** {6DB3FE}Vocк nгo tem permissгo.");
}
return 1;
}
/tdp
Код:
if(strcmp(cmd, "/tdp", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file,"Tenente") >= 0){
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "* Digite: /tdp [id].");
return 1;
}
plid = strval(tmp);
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
if(IsPlayerConnected(plid)){
if(dini_Int(file2,"Profissao") == 3 || dini_Int(file2,"Profissao") == 4 || dini_Int(file2,"Profissao") == 5 || dini_Int(file2,"Profissao") == 6 || dini_Int(file2,"Profissao") == 7 || dini_Int(file2,"Profissao") == 8
|| dini_Int(file2,"Profissao") == 9 || dini_Int(file2,"Profissao") == 10 || dini_Int(file2,"Profissao") == 28 || dini_Int(file2,"Profissao") == 31 || dini_Int(file2,"Profissao") == 32){
dini_IntSet(file2,"Profissao",0);

dini_IntSet(file2,"Punidoo", 1);
format(string, sizeof(string),"O Tenente %s(ID: %d) retirou %s(ID:%d) da policia", aname, playerid,pname,plid);
SendClientMessageToAll(0xFF66FFAA, string);
Logarprof(plid);
}
}
}else{
format(string, sizeof(string), "(ERRO) Jogador nгo conectado!");
SendClientMessage(playerid, Vermelho, string);
}
return 1;
}
Reply
#6

/cnp
Код:
if(strcmp(cmd, "/cnp", true) == 0) {
new id;
//new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "/cnp [id]");
return 1;
}
id = strval(tmp);
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file,"Tenente") == 1)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(id, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
dini_IntSet(file2, "Punidoo", 0);
format(string, sizeof(string),"O Tenente %s(ID: %d) colocou %s(ID:%d) na policia novamente", aname, playerid,pname,id);
SendClientMessageToAll(0xFF66FFAA, string);
} else {
SendClientMessage(playerid, Vermelho, "** {6DB3FE}Vocк nгo tem permissгo.");
}
return 1;
}
/tdp
Код:
if(strcmp(cmd, "/tdp", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file,"Tenente") >= 0){
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "* Digite: /tdp [id].");
return 1;
}
plid = strval(tmp);
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
if(IsPlayerConnected(plid)){
if(dini_Int(file2,"Profissao") == 3 || dini_Int(file2,"Profissao") == 4 || dini_Int(file2,"Profissao") == 5 || dini_Int(file2,"Profissao") == 6 || dini_Int(file2,"Profissao") == 7 || dini_Int(file2,"Profissao") == 8
|| dini_Int(file2,"Profissao") == 9 || dini_Int(file2,"Profissao") == 10 || dini_Int(file2,"Profissao") == 28 || dini_Int(file2,"Profissao") == 31 || dini_Int(file2,"Profissao") == 32){
dini_IntSet(file2,"Profissao",0);

dini_IntSet(file2,"Punidoo", 1);
format(string, sizeof(string),"O Tenente %s(ID: %d) retirou %s(ID:%d) da policia", aname, playerid,pname,plid);
SendClientMessageToAll(0xFF66FFAA, string);
Logarprof(plid);
}
}
}else{
format(string, sizeof(string), "(ERRO) Jogador nгo conectado!");
SendClientMessage(playerid, Vermelho, string);
}
return 1;
}
Reply
#7

I'm sure if you know what mean intendation. Look at this code:
PHP код:
CMD:me(playeridparams[])  
{  
    new 
msg[200];  
    if(
sscanf(params,"s[200]"msg)) return SendClientMessage(playerid, -1"/me [Message] - Make an action");  
    if(
strlen(msg) >= 26SendSplitMessage(playeridCOLOR_PURPLEmsg[0]);  
    else 
ProxDetector(30playeridmsgCOLOR_PURPLE);   
    return 
1;  

This one is pretty simple and there is intendation.
Now this one have NO intendation:
PHP код:
CMD:me(playeridparams[])  
{  
new 
msg[200];  
if(
sscanf(params,"s[200]"msg)) return SendClientMessage(playerid, -1"/me [Message] - Doing an action");  
if(
strlen(msg) >= 26SendSplitMessage(playeridCOLOR_PURPLEmsg[0]);  
else 
ProxDetector(30playeridmsgCOLOR_PURPLE);   
return 
1;  

Reply
#8

Apologies, following correct code:
/cnp
PHP код:
if(strcmp(cmd"/cnp"true) == 0) {
new 
id;
//new tmp[256];
tmp strtok(cmdtextidx);
if(!
strlen(tmp)){
SendClientMessage(playeridVermelho"/cnp [id]");
return 
1;
}
id strval(tmp);
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playeridanameMAX_PLAYER_NAME);
format(filesizeof(file), P_CONTASaname);
if(
dini_Int(file,"Tenente") == 1)
{
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(idpnameMAX_PLAYER_NAME);
format(file2sizeof(file2), P_CONTASpname);
dini_IntSet(file2"Punidoo"0);
format(stringsizeof(string),"O Tenente %s(ID: %d) colocou %s(ID:%d) na policia novamente"anameplayerid,pname,id);
SendClientMessageToAll(0xFF66FFAAstring);
} else {
SendClientMessage(playeridVermelho"** {6DB3FE}Vocк nгo tem permissгo.");
}
return 
1;

/tdp:
PHP код:
if(strcmp(cmd"/tdp"true) == 0) {
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playeridanameMAX_PLAYER_NAME);
format(filesizeof(file), P_CONTASaname);
if(
dini_Int(file,"Tenente") >= 0){
new 
plid;
tmp strtok(cmdtextidx);
if(!
strlen(tmp)) {
SendClientMessage(playeridVermelho"* Digite: /tdp [id].");
return 
1;
}
plid strval(tmp);
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(plidpnameMAX_PLAYER_NAME);
format(file2sizeof(file2), P_CONTASpname);
if(
IsPlayerConnected(plid)){
if(
dini_Int(file2,"Profissao") == || dini_Int(file2,"Profissao") == || dini_Int(file2,"Profissao") == || dini_Int(file2,"Profissao") == || dini_Int(file2,"Profissao") == || dini_Int(file2,"Profissao") == 8
|| dini_Int(file2,"Profissao") == || dini_Int(file2,"Profissao") == 10 || dini_Int(file2,"Profissao") == 28 || dini_Int(file2,"Profissao") == 31 || dini_Int(file2,"Profissao") == 32){
dini_IntSet(file2,"Profissao",0);
dini_IntSet(file2,"Punidoo"1);
format(stringsizeof(string),"O Tenente %s(ID: %d) retirou %s(ID:%d) da policia"anameplayerid,pname,plid);
SendClientMessageToAll(0xFF66FFAAstring);
Logarprof(plid);
}
}
}else{
format(stringsizeof(string), "(ERRO) Jogador nгo conectado!");
SendClientMessage(playeridVermelhostring);
}
return 
1;

They are aligned left even ..
Reply
#9

Have you
PHP код:
#tabsize 0 
?
If yes, remove it, fix your code and repost it.
Reply
#10

Does not
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)