PDA

View Full Version : in game type command saying that unknown command


OfekEfron
08/07/2018, 02:30 PM
CMD:myupgrades(playerid, params[])
{
if(gPlayerLogged{playerid} == 0) return SendClientMessageEx(playerid, COLOR_WHITE,"You need to login before using commands");
new string[1200];
new spawmarm = PlayerInfo[playerid][pSHealth];
new gunloc1 = HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade];
new gunloc2 = HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade];
format(string, sizeof(string), "_____ %s's upgrades (%d upgrade points available) _____", RemoveUnderScore(playerid),PlayerInfo[playerid][gPupgrade]);
SendClientMessageEx(playerid, COLOR_LIMITLESSBLUE,string);
format(string, sizeof(string), "{FFFF00}[Spawn Armour: %.2f/50] {9c9c9c}you spawn with '{FFFF00}%.2f{9c9c9c}' armour at the hospital after death.", PlayerInfo[playerid][pSHealth],spawmarm);
SendClientMessageEx(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 1 Gun Lockers: %d/4] {9c9c9c}your first house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade],gunloc1);
SendClientMessageEx(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 2 Gun Lockers: %d/4] {9c9c9c}your second house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade],gunloc2);
SendClientMessageEx(playerid, COLOR_WHITE,string);
return 1;
}

For some reason when player type the command in game that saying that there is no command like that, and there is one

Florin48
08/07/2018, 02:38 PM
try now

CMD:myupgrades(playerid, params[])
{
if(gPlayerLogged{playerid} == 0) return SendClientMessage(playerid, COLOR_WHITE,"You need to login before using commands");
new string[256], Float:spawmarm = PlayerInfo[playerid][pSHealth], gunloc1 = HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade], gunloc2 = HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade];
format(string, sizeof(string), "_____ %s's upgrades (%d upgrade points available) _____", RemoveUnderScore(playerid),PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_LIMITLESSBLUE,string);
format(string, sizeof(string), "{FFFF00}[Spawn Armour: %.2f/50] {9c9c9c}you spawn with '{FFFF00}%.2f{9c9c9c}' armour at the hospital after death.", PlayerInfo[playerid][pSHealth],spawmarm);
SendClientMessage(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 1 Gun Lockers: %d/4] {9c9c9c}your first house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade],gunloc1);
SendClientMessage(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 2 Gun Lockers: %d/4] {9c9c9c}your second house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade],gunloc2);
SendClientMessage(playerid, COLOR_WHITE,string);
return 1;
}

RogueDrifter
08/07/2018, 02:42 PM
try now

CMD:myupgrades(playerid, params[])
{
if(gPlayerLogged{playerid} == 0) return SendClientMessage(playerid, COLOR_WHITE,"You need to login before using commands");
new string[256], Float:spawmarm = PlayerInfo[playerid][pSHealth], gunloc1 = HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade], gunloc2 = HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade];
format(string, sizeof(string), "_____ %s's upgrades (%d upgrade points available) _____", RemoveUnderScore(playerid),PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_LIMITLESSBLUE,string);
format(string, sizeof(string), "{FFFF00}[Spawn Armour: %.2f/50] {9c9c9c}you spawn with '{FFFF00}%.2f{9c9c9c}' armour at the hospital after death.", PlayerInfo[playerid][pSHealth],spawmarm);
SendClientMessage(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 1 Gun Lockers: %d/4] {9c9c9c}your first house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade],gunloc1);
SendClientMessage(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 2 Gun Lockers: %d/4] {9c9c9c}your second house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade],gunloc2);
SendClientMessage(playerid, COLOR_WHITE,string);
return 1;
}
You clearly have no clue what you're even saying.


@OT: Are you using the callback OnPlayerCommandText? If you are change it to OnPlayerCommandPerformed

OfekEfron
08/07/2018, 02:46 PM
You clearly have no clue what you're even saying.


@OT: Are you using the callback OnPlayerCommandText? If you are change it to OnPlayerCommandPerformed

what he did need to work, he make the var Float because is getting a health number :)
edit: the command still dont work

Calisthenics
08/07/2018, 02:47 PM
HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade]
HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade]


Run time error 4. Check if player has a key before using it in array.

RogueDrifter
08/07/2018, 02:47 PM
what he did works for me, he make the var Float because is getting a health number :)
And how did that send an unknown command message? Well okay if it worked then go for it.

OfekEfron
08/07/2018, 02:56 PM
HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade]
HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade]


Run time error 4. Check if player has a key before using it in array.

what you saying about this?

CMD:myupgrades(playerid, params[])
{
if(gPlayerLogged{playerid} == 0) return SendClientMessage(playerid, COLOR_WHITE,"You need to login before using commands");
new string[256], Float:spawmarm = PlayerInfo[playerid][pSHealth], gunloc1 = HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade], gunloc2 = HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade];
if(PlayerInfo[playerid][pPhousekey] != 0 && PlayerInfo[playerid][pPhousekey2] != 0)
{
format(string, sizeof(string), "_____ %s's upgrades (%d upgrade points available) _____", RemoveUnderScore(playerid),PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_LIMITLESSBLUE,string);
format(string, sizeof(string), "{FFFF00}[Spawn Armour: %.2f/50] {9c9c9c}you spawn with '{FFFF00}%.2f{9c9c9c}' armour at the hospital after death.", PlayerInfo[playerid][pSHealth],spawmarm);
SendClientMessage(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 1 Gun Lockers: %d/4] {9c9c9c}your first house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey]][hGLUpgrade],gunloc1);
SendClientMessage(playerid, COLOR_WHITE,string);
format(string, sizeof(string), "{FFFF00}[House 2 Gun Lockers: %d/4] {9c9c9c}your second house have '{FFFF00}%d{9c9c9c}' guns lockers.", HouseInfo[PlayerInfo[playerid][pPhousekey2]][hGLUpgrade],gunloc2);
SendClientMessage(playerid, COLOR_WHITE,string);
}
else
{
format(string, sizeof(string), "_____ %s's upgrades (%d upgrade points available) _____", RemoveUnderScore(playerid),PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_LIMITLESSBLUE,string);
format(string, sizeof(string), "{FFFF00}[Spawn Armour: %.2f/50] {9c9c9c}you spawn with '{FFFF00}%.2f{9c9c9c}' armour at the hospital after death.", PlayerInfo[playerid][pSHealth],spawmarm);
SendClientMessage(playerid, COLOR_WHITE,string);
SendClientMessage(playerid, COLOR_WHITE,"{FFFF00}[House 1 Gun Lockers: 0/4] {9c9c9c}your first house have '{FFFF00}0{9c9c9c}' guns lockers.");
SendClientMessage(playerid, COLOR_WHITE,"{FFFF00}[House 2 Gun Lockers: 0/4] {9c9c9c}your second house have '{FFFF00}0{9c9c9c}' guns lockers.");
}
return 1;
}

Calisthenics
08/07/2018, 03:08 PM
Declare gunloc1 and gunloc2 inside the if statement.

CodeStyle175
08/07/2018, 03:12 PM
why are you still writing such code?

Calisthenics
08/07/2018, 03:17 PM
I can agree on that. People use bad habbits from old gamemodes and makes readability and writing code more difficult.

Arrays always start from index 0 and not 1.
Use of arrays instead of pKey1, pKey2 etc

Florin48
08/07/2018, 03:19 PM
I can agree on that. People use bad habbits from old gamemodes and makes readability and writing code more difficult.

Arrays always start from index 0 and not 1.
Use of arrays instead of pKey1, pKey2 etc

very true

coool
08/07/2018, 03:26 PM
very true
This can be considered a one liner to increase post count.

Florin48
08/07/2018, 03:28 PM
This can be considered a one liner to increase post count.

This can be considered a one liner to increase post count.

OfekEfron
08/07/2018, 07:41 PM
Can someone help me to get the command fine that player will be able to use it?