CMD:respect(playerid, params[]) { new Player, Reason[256]; new Str[2500]; //-------------------------------------------------------------------------- if(sscanf(params, "uS[256]", Player, Reason)) return SendUsage(playerid, "/Respect [ID/Name] [1/-1] [Reason]"); //-------------------------------------------------------------------------- else if(!IsPlayerConnected(Player)) return SendClientMessage(playerid, COLOR_ULTRARED, "{00FF40}Player not connected"); //-------------------------------------------------------------------------- else if(Player == playerid) return SendClientMessage(playerid, COLOR_ULTRARED, "{00FF40}You cannot give yourself respect!"); //-------------------------------------------------------------------------- else if((gettime() - rldtime[playerid]) < 180) return SendClientMessage(playerid, COLOR_ULTRARED, "{00FF40}Sorry, but you can give a point of respect only once in an 3 minutes!"); //-------------------------------------------------------------------------- else { //---------------------------------------------------------------------- if(CosminInfo[playerid][Like] == 0) { CosminInfo[Player][Like] += 1; format(Str, 2500, "{FFFF1A}You have recieved a positive respect point from %s with reason: %s",PlayerName(playerid), playerid, Reason); SendClientMessage(Player, COLOR_YELLOW, Str); format(Str, 2500, "{FFFF1A}You have given %s a positvive respect point with reason: %s", PlayerName(Player), playerid, Reason); SendClientMessage(playerid, COLOR_YELLOW, Str); rldtime[playerid] = gettime(); } //---------------------------------------------------------------------- else if(CosminInfo[playerid][Dislike] == 0) { CosminInfo[Player][Dislike] += 1; format(Str, 2500, "{FFFF1A}You have recieved a negative respect point from %s with reason: %s",PlayerName(playerid), playerid, Reason); SendClientMessage(Player, COLOR_YELLOW, Str); format(Str, 2500, "{FFFF1A}You have given %s a negative respect point with reason: %s", PlayerName(Player), playerid, Reason); SendClientMessage(playerid, COLOR_YELLOW, Str); rldtime[playerid] = gettime(); } //---------------------------------------------------------------------- } return 1; }
Reason[256]; new Str[2500]; |
if(CosminInfo[playerid][Like] == 0) |
if(sscanf(params, "uS[256]", Player, Reason)) |
SendUsage(playerid, "/Respect [ID/Name] [1/-1] [Reason]"); |
format(Str, 2500, " |
format(Str, sizeof(Str), " |
You have to be more precise here...
Can you define 'don't work so great' please? Looking at your code... I have a few things I would like to point out. Why would you locate a size of 2500? That's a lot of memory that will never be used. Also the reason is way to big of size. I don't imagine a whole story being written into a reason, neither will it be possible to send a message within SendClientMessage that is over 144 characters long. With this check it would only be possible for a player to be liked (or disliked) 1 time and never again. You are using sscanf to declare and check for two variables, although, if I look at your I am assuming you want 3 parameters to be used. Another thing... format(Str, 2500, "{FFFF1A}You have recieved a positive respect point from %s with reason: %s",PlayerName(playerid), playerid, Reason); These parameters are not adding up... You are declaring two parameters (First one with PlayerName and second one with playerid, there is no other one to be used for 'Reason' You could also do (And should) instead of do |
if(sscanf(params, "uS[256]", Player, Reason))
HTML Code:
if(sscanf(params, "uS[256]", Player, Reason)) |
if(sscanf(params, "uiS[256]", Player, Amount, Reason))
I addressed where the problems are comming from and how they should be handled.
What is it you have an issue with for fixing it?\ Edit; Add another param in the sscanf. Example: Code:
if(sscanf(params, "uiS[256]", Player, Amount, Reason)) |