CMD: to strcmp ? - 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: CMD: to strcmp ? (
/showthread.php?tid=331034)
CMD: to strcmp ? -
kidor - 03.04.2012
Hy guys, can someone help me with this command , i use strcmp .. and i tried to make it to strcmp but i failed ..
pawn Код:
CMD:radar(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new string[128];
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "* %s takes out a speed radar and shoots it out.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_GREEN, "Nearest vehicles speed:");
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && i!=playerid)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if (ProxDetectorS(30.0, playerid, i) && Speed[i] > 15)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
giveplayer[strfind(giveplayer,"_")] = ' ';
format(string, sizeof(string), "Vehicle:%s Name:%s speed ~%dkm/h", VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400],giveplayer,Speed[i]);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You are not a cop!");
return 1;
}
return 1;
}
return 1;
}
Re: CMD: to strcmp ? -
blank. - 03.04.2012
Why would you degrade it?
Re: CMD: to strcmp ? -
kidor - 03.04.2012
Quote:
Originally Posted by blank.
Why would you degrade it?
|
I don't understand what are u try to say, i just want to make the command for strcmp because with CMD: i can't use it.
Re: CMD: to strcmp ? -
Jonny5 - 03.04.2012
he means that useing strcmp over a command processor is degrading it,
look up ZCMD or YCMD or DCMD they are very very easy to use
and make writing commands so much easier!
I use YCMD and many others ZCMD i think dcmd is old and slow too.
Re: CMD: to strcmp ? -
kidor - 03.04.2012
Yes, but i need it for strcmp ? can some one help?
Re: CMD: to strcmp ? -
sjvt - 03.04.2012
pawn Код:
CMD:radar(playerid, params[])
{
replace that with
pawn Код:
if (strcmp("/radar", cmdtext, true, 6) == 0)
{
But i think it wont work because you dont use
pawn Код:
PlayerInfo[playerid][pLeader]
PlayerInfo[playerid][pMember]
ProxDetector
VehicleNames[GetVehicleModel(GetPlayerVehicleID(i)) // Easy to fix
Re: CMD: to strcmp ? -
kidor - 03.04.2012
Quote:
Originally Posted by sjvt
pawn Код:
CMD:radar(playerid, params[]) {
replace that with
pawn Код:
if (strcmp("/radar", cmdtext, true, 6) == 0) {
But i think it wont work because you dont use
pawn Код:
PlayerInfo[playerid][pLeader] PlayerInfo[playerid][pMember] ProxDetector VehicleNames[GetVehicleModel(GetPlayerVehicleID(i)) // Easy to fix
|
I tried like u sayd, but when i type /radar i get "SERVER: Unknown Command"
Re: CMD: to strcmp ? -
sjvt - 03.04.2012
Because you didn't put it between
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
and
Re: CMD: to strcmp ? -
kidor - 03.04.2012
Quote:
Originally Posted by sjvt
Because you didn't put it between
pawn Код:
public OnPlayerCommandText(playerid, cmdtext) {
and
|
The same .. "SERVER: Unknown Command"
Re: CMD: to strcmp ? -
sjvt - 03.04.2012
send code