OnPlayerText


Započeo krizmanikdev, Jul 08, 2021, 16:57:22 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): ovako, imam sistem u kojem se igracu na connectu da neka random boja(setplayercolor), i ja ne znam kako da napravim da u onplayertext(kada igraC pise u chat) samo igracevo ime ima tu boju
Deo skripte:
if(PlayerInfo[playerid][pVip] == 1)
	{
        GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
        format(string,sizeof(string),""GREY"[member=1996][/member] "GREY"["COL_LIGHTBLUE"VIP"GREY"] "COL_LIGHTBLUE"%s "GREY":"COL_LIGHTBLUE" %s",GetName(playerid),text);
        SendNearByMessage(playerid, -1, 20.0, string);
		return 0;
	}

Random Color::
new randomColor[200] = {
	0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,
	0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,
	0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,
	0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,0x3D0A4FFF,
	0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,
	0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,
	0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,
	0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,
	0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,
	0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,0xDCDE3DFF,
	0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
	0xD8C762FF,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,
	0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,
	0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,
	0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,
	0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
	0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,
	0x18F71FFF,0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,
	0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,
	0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,
	0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,
	0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,
	0xD8C762FF,0xD8C762FF
};

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log)://
Poslednja Izmena: Jul 09, 2021, 20:30:00 POSLE PODNE od M Ө M Σ N Z I


Na connect-u sacuvaj boju igraca ili iskoristi od gore GetPlayerColor sto je Ljubisa poslao.

Posle kada igrac pise u OnPlayerText tu boju mozes da iskoristis za njegovo ime 


new str[16];
format(str, sizeof str, "{%06x}", GetPlayerColor(playerid) >>> 8);   // ovako konvertujes u hex tj onih 6 slova sto predstavljaju boju


format(string, sizeof string,""GREY"["COL_LIGHTBLUE"VIP"GREY"] "str"%s "GREY":"COL_LIGHTBLUE" %s",GetName(playerid),text);

Citat: tutankamon poslato Jul 08, 2021, 17:12:17 POSLE PODNE
Na connect-u sacuvaj boju igraca ili iskoristi od gore GetPlayerColor sto je Ljubisa poslao.

Posle kada igrac pise u OnPlayerText tu boju mozes da iskoristis za njegovo ime 


new str[16];
format(str, sizeof str, "{%06x}", GetPlayerColor(playerid) >>> 8);   // ovako konvertujes u hex tj onih 6 slova sto predstavljaju boju


format(string, sizeof string,""GREY"["COL_LIGHTBLUE"VIP"GREY"] "str"%s "GREY":"COL_LIGHTBLUE" %s",GetName(playerid),text);


C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : warning 215: expression has no effect
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : error 001: expected token: ";", but found "-string-"
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : warning 215: expression has no effect
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : warning 215: expression has no effect
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : error 001: expected token: ";", but found ")"
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : fatal error 107: too many error messages on one line

Citat: Lukq poslato Jul 08, 2021, 17:19:18 POSLE PODNE
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : warning 215: expression has no effect
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : error 001: expected token: ";", but found "-string-"
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : warning 215: expression has no effect
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : warning 215: expression has no effect
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : error 001: expected token: ";", but found ")"
C:\Users\User\Pictures\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\ElegantDM.pwn(1013) : fatal error 107: too many error messages on one line

Obrisi str, stavi samo donju liniju ovako:

format(string, sizeof string,""GREY"["COL_LIGHTBLUE"VIP"GREY"] {%06x}%s "GREY":"COL_LIGHTBLUE" %s", GetPlayerColor(playerid) >>> 8, GetName(playerid),text);

Citat: tutankamon poslato Jul 08, 2021, 17:40:26 POSLE PODNE
Obrisi str, stavi samo donju liniju ovako:

format(string, sizeof string,""GREY"["COL_LIGHTBLUE"VIP"GREY"] {%06x}%s "GREY":"COL_LIGHTBLUE" %s", GetPlayerColor(playerid) >>> 8, GetName(playerid),text);


sad imam 50 ovakvih warninga

C:\Users\User\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\Legacy.pwn(3972) : warning 219: local variable "string" shadows a variable at a preceding level

Citat: Lukq poslato Jul 08, 2021, 17:42:52 POSLE PODNE
sad imam 50 ovakvih warninga

C:\Users\User\Serveri\#LegacyDeathmatch\click\Legacy Deathmatch by lukq\gamemodes\Legacy.pwn(3972) : warning 219: local variable "string" shadows a variable at a preceding level


To je zato sto koristis string i u ostalim funkcijama, a verovatno postoji jedan globalni string tako da samo promeni ime u format funkciji
umesto string nesto drugo sto se ne koristi.

Citat: tutankamon poslato Jul 08, 2021, 17:43:57 POSLE PODNE

To je zato sto koristis string i u ostalim funkcijama, a verovatno postoji jedan globalni string tako da samo promeni ime u format funkciji
umesto string nesto drugo sto se ne koristi.

da, fixo sam warninge idem ig da probam