SA-MP Forums Archive
Cmd Prob? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Cmd Prob? (/showthread.php?tid=388429)



Cmd Prob? - KP2 - 28.10.2012

Guys i have a problem with strcmp.. I make any cmd suppose anything it dosent work, i write the cmd in game but dosent work+ dosent give me any unknown command warning. why


Re: Cmd Prob? - VIP475 - 28.10.2012

could you copy paste the command lines from your script?


Re: Cmd Prob? - KP2 - 29.10.2012

ok so i downloaded this fs from here (dont remember from where Sorry!) and had this lines
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/snow"cmdtexttrue5) == 0// Put snow for all players (Administrator)
    
{
        for(new 
0<MAX_PLAYERSi++){
        if(!
IsPlayerConnected(i)) continue;
        if(
IsPlayerAdmin(i)){
        if(
SnowOff[i] == 0){
        
AttachObjectToPlayer(Snow[i], i1.50.5001.52);
        
SnowOff[i] = 0;}}}
        return 
1;
    }
    if (
strcmp("/removesnow"cmdtexttrue7) == 0//  Removed snow for all players (Administrator)
    
{
        for(new 
0<MAX_PLAYERSi++){
        if(!
IsPlayerConnected(i)) continue;
        if(
IsPlayerAdmin(i)){
        if(
SnowOff[i] == 1){
        
DestroyPlayerObject(iSnow[i]);
        
SnowOff[i] = 1;}}}
        return 
1;
    }
    if (
strcmp("/snowon"cmdtexttrue7) == 0// Put snow for you
    
{
         if(
SnowOff[playerid] == 0) return SendClientMessage(playeridred"Vous avez mit la neige pour vous.");
         
AttachObjectToPlayer(Snow[playerid], playerid1.50.5001.52);
         
SnowOff[playerid] = 0;
         return 
1;
    }
    if (
strcmp("/snowoff"cmdtexttrue8) == 0// Remove snow for you
    
{
         if(
SnowOff[playerid] == 1) return SendClientMessage(playeridred"Vous avez enlever la neige pour vous.");
         
DestroyPlayerObject(playeridSnow[playerid]);
         
SnowOff[playerid] = 1;
         return 
1;
    }
    return 
0;

I made many cmds by strcmp but no one work not even gives an error!


Re: Cmd Prob? - OKStyle - 23.12.2014

Full code with all objects and params.

pawn Код:
#include <a_samp>

#define red 0xFF0000AA

new Snow[MAX_PLAYERS];
new SnowOff[MAX_PLAYERS];

public OnFilterScriptInit()
{
      for(new i = 0; i <MAX_PLAYERS; i++){
      Snow[i] = CreatePlayerObject(i, 18864, 0, 0, 0, 0, 0, 0);}
   return 1;
}

public OnPlayerConnect(playerid)
{
      AttachObjectToPlayer(Snow[playerid], playerid, 1.5, 0.5, 0, 0, 1.5, 2);
      SnowOff[playerid] = 0;
      return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
      if (strcmp("/snow", cmdtext, true, 5) == 0) // Включить снега для всех игроков.
   {
          for(new i = 0; i <MAX_PLAYERS; i++){
          if(!IsPlayerConnected(i)) continue;
          if(IsPlayerAdmin(i)){
          if(SnowOff[i] == 1){
          AttachObjectToPlayer(Snow[i], i, 1.5, 0.5, 0, 0, 1.5, 2);
          SnowOff[i] = 0;}}}
       return 1;
   }

      if (strcmp("/nosnow", cmdtext, true, 7) == 0) // Отключить Снег для всех игроков.
   {
          for(new i = 0; i <MAX_PLAYERS; i++){
          if(!IsPlayerConnected(i)) continue;
          if(IsPlayerAdmin(i)){
          if(SnowOff[i] == 0){
       DestroyPlayerObject(i, Snow[i]);
          SnowOff[i] = 1;}}}
       return 1;
   }

      if (strcmp("/snowon", cmdtext, true, 7) == 0) // Включить снега для игрока, если игрок отключил его раньше.
   {
           if(SnowOff[playerid] == 1){
        AttachObjectToPlayer(Snow[playerid], playerid, 1.5, 0.5, 0, 0, 1.5, 2);
        SendClientMessage(playerid, red, "Вы включили снег для себя.");
           SnowOff[playerid] = 0;}
     return 1;
   }

      if (strcmp("/snowoff", cmdtext, true, 8) == 0) // Отключить снег только 1 игрок.
   {
           if(SnowOff[playerid] == 0){  
        DestroyPlayerObject(playerid, Snow[playerid]);
        SendClientMessage(playerid, red, "Вы отключили снега для себя.");
           SnowOff[playerid] = 1;}
     return 1;
   }
   return 0;
}



Re: Cmd Prob? - Glossy42O - 23.12.2014

Isn't it suppose to be in scripting help section board?