if (!strcmp(cmd, "/pintarcarro") ) {
if ( !IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");
tmp = strtok(cmdtext, idx);
if ( !strlen(tmp) )
return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
new cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if ( !strlen(tmp) )
return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
new cor2 = strval(tmp);
if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");
ChangeVehicleColor(GetPlayerVehicleID(playerid), cor1 , cor2 );
format (tmp, sizeof tmp, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
SendClientMessage(playerid, -1, tmp);
return 1;
}
CMD:pintarcarro(playerid, params[]) {
if ( !IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");
new cor1, cor2;
if ( sscanf(params, "dd", cor1, cor2) )
return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");
new info[60];
ChangeVehicleColor(GetPlayerVehicleID(playerid), cor1 , cor2 );
format (info, sizeof info, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
SendClientMessage(playerid, -1, info);
return 1;
}
Strcmp
pawn Код:
pawn Код:
|
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(627) : error 017: undefined symbol "cmd"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(632) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(632) : error 017: undefined symbol "idx"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(634) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(637) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(639) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(639) : error 017: undefined symbol "idx"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(641) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(644) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(651) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(651) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(652) : error 017: undefined symbol "tmp"
new cmd
new tmp
new idx
Crie essas variбveis.
pawn Код:
|
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(628) : error 017: undefined symbol "cmd"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(635) : error 006: must be assigned to an array
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(637) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(640) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(642) : error 006: must be assigned to an array
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(644) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(647) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(654) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(654) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(655) : error 035: argument type mismatch (argument 3)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(642) : warning 204: symbol is assigned a value that is never used: "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(629) : warning 203: symbol is never used: "cmd"
public OnPlayerCommandText(playerid, cmdtext[]) {
new cmd[128], idx;
new tmp[128];
cmd = strtok(cmdtext, idx);
if (!strcmp(cmd, "/pintarcarro") ) {
if ( !IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");
tmp = strtok(cmdtext, idx);
if ( !strlen(tmp) )
return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
new cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if ( !strlen(tmp) )
return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
new cor2 = strval(tmp);
if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");
ChangeVehicleColor(GetPlayerVehicleID (playerid), cor1 , cor2 );
format (tmp, sizeof tmp, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
SendClientMessage(playerid, -1, tmp);
return 1;
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(628) : error 017: undefined symbol "cmd"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(629) : warning 204: symbol is assigned a value that is never used: "cmd"
if (!strcmp(cmdtext, "/pintarcarro") ) {
new cmd[64],idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/pintar", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new
string[128],
tmp[64];
tmp = strtok(cmdtext, idx);
new
tmp2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid),tmp2,tmp2);
format(string, sizeof(string),"Cor do seu carro foi mudada para: %i",tmp2);
SendClientMessage(playerid, 0xF60000AA, string);
}
else return SendClientMessage(playerid, 0xF60000AA, "Erro: Vocк nгo ta em nenhum veнculo man!");
return 1;
}