Vip problem
#1

Thx you all for every thing and this is going to be my last thread ;d anyway

Код:
CMD:fix(playerid, params[])
{
   new vehicleid = GetPlayerVehicleID(playerid);
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   IsPlayerInAnyVehicle(playerid);
   SetVehicleHealth(vehicleid, 1000.0);
   return 1;
}

CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYERS];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   GetPlayerName(playerid, name, MAX_PLAYERS);
   format(string, sizeof(string), "%s: %s", name);
   SendClientMessageToAll(-1, string);
   return 1;
}
i can't fix the car

when i chat /v it only texts my name ExTrevoman: but not the name why?
Reply
#2

pawn Код:
CMD:fix(playerid, params[])
{
   new vehicleid = GetPlayerVehicleID(playerid);
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   IsPlayerInAnyVehicle(playerid);
   SetVehicleHealth(vehicleid, 1000.0);
   RepairVehicle(vehicleid);
   return 1;
}

CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYERS_NAME];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   GetPlayerName(playerid, name,MAX_PLAYERS_NAME);//here was the problem
   format(string, sizeof(string), "%s: %s", name);// onemore prob here tell that fast whats the next thing??
   SendClientMessageToAll(-1, string);
   return 1;
}
One more thing whats the next thing after `name` in that format string in that command of /v
Reply
#3

Quote:
Originally Posted by -=Dar[K]Lord=-
Посмотреть сообщение
pawn Код:
CMD:fix(playerid, params[])
{
   new vehicleid = GetPlayerVehicleID(playerid);
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   IsPlayerInAnyVehicle(playerid);
   SetVehicleHealth(vehicleid, 1000.0);
   RepairVehicle(vehicleid);
   return 1;
}

CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYERS_NAME];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   GetPlayerName(playerid, name,MAX_PLAYERS_NAME);//here was the problem
   format(string, sizeof(string), "%s: %s", name);// onemore prob here tell that fast whats the next thing??
   SendClientMessageToAll(-1, string);
   return 1;
}
One more thing whats the next thing after `name` in that format string in that command of /v
It's probably params, so it would look like this:

pawn Код:
CMD:fix(playerid, params[])
{
   new vehicleid = GetPlayerVehicleID(playerid);
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   IsPlayerInAnyVehicle(playerid);
   SetVehicleHealth(vehicleid, 1000.0);
   RepairVehicle(vehicleid);
   return 1;
}

CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYERS_NAME];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   GetPlayerName(playerid, name,MAX_PLAYERS_NAME);
   format(string, sizeof(string), "%s: %s", name, params);// added params here
   SendClientMessageToAll(-1, string);
   return 1;
}
Reply
#4

Quote:
Originally Posted by Da_Noob
Посмотреть сообщение
It's probably params, so it would look like this:

pawn Код:
CMD:fix(playerid, params[])
{
   new vehicleid = GetPlayerVehicleID(playerid);
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   IsPlayerInAnyVehicle(playerid);
   SetVehicleHealth(vehicleid, 1000.0);
   RepairVehicle(vehicleid);
   return 1;
}

CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYERS_NAME];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   GetPlayerName(playerid, name,MAX_PLAYERS_NAME);
   format(string, sizeof(string), "%s: %s", name, params);// added params here
   SendClientMessageToAll(-1, string);
   return 1;
}
Yea , it might be , but we cant go against the thinking of the owner of the script so i asked him
Reply
#5

You're not applying anything on one of the '%s'

pawn Код:
CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYERS];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   GetPlayerName(playerid, name, MAX_PLAYERS);
   format(string, sizeof(string), "%s: %s", name); //Here's the problem, you're only applying one variable. When you actually needed 2
   SendClientMessageToAll(-1, string);
   return 1;
}

EDIT

I'm assuming this is a chat for the VIPs right? If so, you're missing the parameter.

pawn Код:
CMD:v(playerid, params[])
{
    if(PlayerData[playerid][VipLevel] >= 1)
    {
        new string[128];
        new message[130];
        new name[MAX_PLAYER_NAME];
        if(sscanf(params, "u", message)) return SendClientMessage(playerid, -1, "Usage: /v [message]");
       {
           GetPlayerName(playerid, name, MAX_PLAYERS);
           format(string, sizeof(string), "%s: %s", message);
           SendClientMessageToAll(-1, string);
        }
    }
    else return 0;
   return 1;
}
Here's the complete code.
Reply
#6

Quote:
Originally Posted by -=Dar[K]Lord=-
Посмотреть сообщение
Yea , it might be , but we cant go against the thinking of the owner of the script so i asked him
True, but if you look at the code: he never used sscanf or anything, so it'll probably be params
Reply
#7

Ken97 still i can't write
Reply
#8

i fixed it with your help thanks


Код:
CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYER_NAME];
   new message[130];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   if(sscanf(params, "u", message)) return SendClientMessage(playerid, -1, "Usage: /v [message]");
   GetPlayerName(playerid, name,MAX_PLAYER_NAME);
   format(string, sizeof(string), "%s: %s", name, params);
   SendClientMessageToAll(-1, string);
   return 1;
}
Reply
#9

Quote:
Originally Posted by kaloqn54
Посмотреть сообщение
i fixed it with your help thanks


Код:
CMD:v(playerid, params[])
{
   new string[128];
   new name[MAX_PLAYER_NAME];
   new message[130];
   if(PlayerData[playerid][VipLevel] < 1) return 0;
   if(sscanf(params, "u", message)) return SendClientMessage(playerid, -1, "Usage: /v [message]");
   GetPlayerName(playerid, name,MAX_PLAYER_NAME);
   format(string, sizeof(string), "%s: %s", name, params);
   SendClientMessageToAll(-1, string);
   return 1;
}
You should change

pawn Код:
if(sscanf(params, "u", message)) return SendClientMessage(playerid, -1, "Usage: /v [message]");
to

pawn Код:
if(sscanf(params, "s[130]", message)) return SendClientMessage(playerid, -1, "Usage: /v [message]");
If you use "u", you're telling the server that whatever you write after /v is meant to be a playerid. Edit your code as I said and it should work
Reply
#10

Indeed. Mistakenly used 'u' as the parameter instead of 's[130]'
Anyways, use my code and replace the 'u' in the parameter to 's[130]' like what Da_Noob told you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)