06.07.2018, 18:58
you have to check if text variable contains anything, because otherwise sendclientmessageex will crash
and i wouldnt even use that system, because every loop you again format message and then send it, but its better to format first message and then sent it.
and dont use ProxDetector because its just waste of time, because you need to copy this thing every time and colors will be same always, you dont write colors from your head.
and i wouldnt even use that system, because every loop you again format message and then send it, but its better to format first message and then sent it.
and dont use ProxDetector because its just waste of time, because you need to copy this thing every time and colors will be same always, you dont write colors from your head.
PHP код:
ChattingAnim(playerid,time){
if (!PlayerData[playerid][pInjured] && !PlayerData[playerid][pLoopAnim])
{
switch (random(6))
{
case 0: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkA", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 1: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkB", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 2: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkE", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 3: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkF", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 4: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkG", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
case 5: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkH", 4.1, 0, 1, 1, 1, strlen(text) * 100, 1);
}
SetTimerEx("StopChatting", time, false, "d", playerid);
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if (!PlayerData[playerid][pLogged] || !PlayerData[playerid][pCharacter] || PlayerData[playerid][pTutorial] > 0 || PlayerData[playerid][pTutorialStage] > 0 || PlayerData[playerid][pHospital] != -1)
return false;
if(strlen(text) < 3 || strlen(text) > 128)return SendClientMessage(playerid,-1,"Your text must be atleast 3 letters long!"),0;
new s[144];
if (PlayerData[playerid][pNewsGuest] != INVALID_PLAYER_ID && GetFactionType(PlayerData[playerid][pNewsGuest]) == FACTION_NEWS) //&& IsPlayerInAnyVehicle(playerid) && IsNewsVehicle(GetPlayerVehicleID(playerid)))
{
format(s,144,"[NEWS] Guest %s: %s",ReturnName(playerid, 0), text);
foreach (Player,i)
if (!PlayerData[i][pDisableBC]) {
SendClientMessage(i,COLOR_LIGHTGREEN,s);
}
return false;
}
else
{
new
targetid = PlayerData[playerid][pCallLine],
vid=GetPlayerVehicleID(playerid),
text1[128],
text2[128];
if(IsPlayerOnPhone(playerid)) return SendClientMessage(playerid,-1,"You are using your phone!"),0;
new bool:isinveh=!!(IsPlayerInAnyVehicle(playerid) && IsWindowedVehicle(vid) && !CoreVehicles[vid][vehWindowsDown]);
if(!isinveh)ChattingAnim(playerid,strlen(text) * 100);
if(strlen(text) > 90) {
strmid(text1, text, 0, 90);
strmid(text2, text, 90, 128);
format(s, 144, "%s%s says: %s...",isinveh?("(vehicle) "):(""), ReturnName(playerid, 0), text1);
ProxDetector(25.0, playerid, s, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
format(s, 144, "..%s", ReturnName(playerid, 0), text2);
ProxDetector(25.0, playerid, s, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
}
else
{
format(s, 144, "%s%s says: %s",isinveh?("(vehicle) "):(""), ReturnName(playerid, 0), text);
ProxDetector(25.0, playerid, s, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
}
return false;